/* Premium business UI layer */
:root {
  --ink: #172033;
  --green: #111827;
  --green-2: #4f46e5;
  --cream: #f4f6fa;
  --paper: #ffffff;
  --line: #e6e9f0;
  --muted: #7a8398;
  --gold: #f59e0b;
  --danger: #dc4c64;
  --brand: #5b5ce2;
  --brand-dark: #4546c8;
  --brand-soft: #efefff;
  --cyan: #18a7b5;
  --shadow: 0 12px 30px rgba(30, 41, 59, .06);
  --shadow-lg: 0 24px 70px rgba(21, 29, 53, .14);
}

html { background: var(--cream); }
body {
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 0%, rgba(91, 92, 226, .055), transparent 30%),
    var(--cream);
  font-family: Inter, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease; }
button:active { transform: translateY(1px); }
button:focus { outline: none; }
button:focus-visible {
  outline: 2px solid #7773f2;
  outline-offset: 2px;
}
.eyebrow {
  color: #8b93a7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}
.muted { color: var(--muted); }

/* Login */
.login-shell {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 18%, rgba(115, 109, 255, .34), transparent 25%),
    radial-gradient(circle at 86% 80%, rgba(23, 169, 181, .18), transparent 28%),
    linear-gradient(145deg, #11172b 0%, #171d38 54%, #101525 100%);
}
.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.login-shell::before { width: 530px; height: 530px; top: -265px; right: -140px; }
.login-shell::after { width: 380px; height: 380px; bottom: -230px; left: -100px; }
.login-card {
  position: relative;
  z-index: 1;
  width: min(470px, 100%);
  padding: 52px 48px 46px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 26px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 36px 100px rgba(0,0,0,.32);
}
.login-card::before {
  content: "安全访问";
  position: absolute;
  top: 24px;
  right: 26px;
  padding: 6px 10px;
  border-radius: 99px;
  color: #4b4dcc;
  background: #eeeeff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
.brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  border-radius: 17px;
  background: linear-gradient(135deg, #6d68ee, #4546c8);
  box-shadow: 0 12px 24px rgba(79, 70, 229, .25);
  font-family: inherit;
  font-size: 23px;
  font-weight: 800;
}
.login-card h1 {
  font-family: inherit;
  font-size: 34px;
  font-weight: 780;
  letter-spacing: -.04em;
}
.login-card form { margin-top: 36px; }
.login-card label { color: #525b70; }
.password-row input { height: 50px; }
.password-row .primary { min-width: 112px; }
.create-vault-entry {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid #dfe1ee;
  border-radius: 10px;
  color: #5255be;
  background: white;
  font-size: 13px;
  font-weight: 700;
}
.create-vault-entry:hover { border-color: #bbbdf0; background: #f8f8ff; }
.login-help {
  margin-top: 17px;
  padding: 13px 15px;
  border: 1px solid #e5e5fb;
  border-radius: 10px;
  color: #6e7690;
  background: #f7f7ff;
  font-size: 12px;
  line-height: 1.65;
}
.login-help strong { display: block; margin-bottom: 2px; color: #4f51b9; }
.login-help p { margin: 0; }
.login-help .vault-status {
  margin-top: 7px;
  color: #3f4780;
  font-weight: 700;
}
.vault-setup {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid #dddffa;
  border-radius: 12px;
  background: #f8f8ff;
}
.vault-setup > strong { display: block; color: #35379f; font-size: 15px; }
.vault-setup > p:not(.form-message) { margin: 5px 0 15px; color: #737b90; font-size: 12px; line-height: 1.65; }
.vault-setup input[type="password"] { background: white; }
.remember-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
  color: #626b7e;
  font-size: 12px;
  line-height: 1.55;
}
.remember-warning input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}
.vault-setup-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 15px; }
.primary:disabled {
  cursor: wait;
  opacity: .7;
  transform: none;
  box-shadow: none;
}

/* Shell and sidebar */
.app-shell { grid-template-columns: 256px minmax(0, 1fr); }
.sidebar {
  padding: 26px 18px 22px;
  background:
    radial-gradient(circle at 20% 8%, rgba(111, 103, 255, .17), transparent 24%),
    linear-gradient(180deg, #141a2e 0%, #111625 100%);
  box-shadow: 12px 0 38px rgba(31, 39, 68, .08);
}
.brand {
  gap: 12px;
  min-height: 61px;
  padding: 0 11px 22px;
  border-bottom-color: rgba(255,255,255,.08);
}
.brand .brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, #716df0, #5051d2);
  box-shadow: 0 8px 20px rgba(52, 48, 156, .34);
  font-size: 17px;
}
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand span { color: #78839e; font-size: 10px; letter-spacing: .08em; }
nav { gap: 6px; margin-top: 28px; }
.nav-item {
  position: relative;
  min-height: 47px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #8e99b1;
  font-size: 14px;
  font-weight: 600;
}
.nav-item span {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: #98a2b8;
  background: rgba(255,255,255,.04);
  font-size: 12px;
}
.nav-item:hover { color: #e7eaf2; background: rgba(255,255,255,.045); }
.nav-item.active {
  color: white;
  border-color: rgba(126, 121, 255, .18);
  background: linear-gradient(90deg, rgba(91, 92, 226, .28), rgba(91, 92, 226, .11));
  box-shadow: inset 3px 0 0 #7773f2;
}
.nav-item.active span { color: white; background: #5b5ce2; }
.sidebar-foot {
  align-items: center;
  padding: 18px 10px 0;
  border-top-color: rgba(255,255,255,.08);
  color: #778198;
}
#saveStatus::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #41d39a;
  box-shadow: 0 0 0 4px rgba(65,211,154,.1);
}
.sidebar .text-btn { color: #a7b0c3; font-size: 12px; }
.sidebar-data-actions {
  display: grid;
  gap: 7px;
  margin-top: auto;
  padding: 14px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-data-actions button {
  min-height: 37px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 9px;
  color: #aeb7c9;
  background: rgba(255,255,255,.035);
  font-size: 12px;
}
.sidebar-data-actions button:hover {
  color: white;
  border-color: rgba(119,115,242,.45);
  background: rgba(91,92,226,.15);
}
.sidebar-data-actions + .sidebar-foot { margin-top: 0; }

/* Header */
main { padding: 0 38px 56px; }
.topbar {
  min-height: 94px;
  border-bottom: 1px solid rgba(222,226,235,.78);
}
.topbar .eyebrow { margin-bottom: 5px; }
.topbar h2 {
  font-family: inherit;
  font-size: 27px;
  font-weight: 760;
  letter-spacing: -.035em;
}
.header-actions { gap: 10px; }
.primary, .secondary, .light-btn {
  min-height: 43px;
  padding: 0 17px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 720;
}
.primary {
  color: white;
  background: linear-gradient(135deg, #6564e8, #4f46d1);
  box-shadow: 0 8px 18px rgba(79, 70, 209, .2);
}
.primary:hover {
  background: linear-gradient(135deg, #5655d9, #4039bd);
  box-shadow: 0 10px 24px rgba(79, 70, 209, .29);
  transform: translateY(-1px);
}
.secondary {
  color: #4c566c;
  border-color: #dfe3eb;
  background: rgba(255,255,255,.78);
}
.secondary:hover { border-color: #c7ccda; background: white; }

/* Dashboard */
.page { padding-top: 26px; }
.page.active {
  animation: page-in .28s ease both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero {
  position: relative;
  min-height: 218px;
  align-items: center;
  overflow: hidden;
  padding: 40px 42px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background:
    radial-gradient(circle at 77% 25%, rgba(111, 103, 255, .5), transparent 22%),
    radial-gradient(circle at 98% 110%, rgba(25, 184, 196, .3), transparent 32%),
    linear-gradient(125deg, #171d36 0%, #20284a 55%, #282c58 100%);
  box-shadow: 0 20px 44px rgba(28, 35, 70, .16);
}
.hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -48px;
  top: -105px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
}
.hero::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: 122px;
  bottom: -75px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.hero > * { position: relative; z-index: 1; }
.hero h3 {
  max-width: 680px;
  margin: 5px 0 13px;
  font-family: inherit;
  font-size: clamp(28px, 3.3vw, 42px);
  font-weight: 720;
  letter-spacing: -.045em;
}
.hero p:last-child { max-width: 610px; color: #abb5cf; line-height: 1.8; }
.light-btn {
  min-height: 46px;
  color: #3436ac;
  background: white;
  box-shadow: 0 10px 25px rgba(0,0,0,.15);
}
.light-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.2); }
.stats-grid { gap: 14px; margin: 17px 0; }
.stat-card {
  min-height: 126px;
  padding: 22px 22px 20px;
  border-color: #e6e9f0;
  border-radius: 15px;
  background: rgba(255,255,255,.93);
  box-shadow: 0 4px 14px rgba(31,41,69,.025);
}
.stat-card::before {
  content: "";
  display: block;
  width: 31px;
  height: 4px;
  margin-bottom: 18px;
  border-radius: 99px;
  background: #5b5ce2;
}
.stat-card:nth-child(2)::before { background: #18a7b5; }
.stat-card:nth-child(3)::before { background: #f0a33a; }
.stat-card:nth-child(4)::before { background: #dc5e7a; }
.stat-card::after {
  right: -45px;
  bottom: -54px;
  width: 125px;
  height: 125px;
  background: rgba(91,92,226,.055);
}
.stat-card:nth-child(2)::after { background: rgba(24,167,181,.06); }
.stat-card:nth-child(3)::after { background: rgba(240,163,58,.07); }
.stat-card:nth-child(4)::after { background: rgba(220,94,122,.06); }
.stat-card span { color: #81899c; font-size: 12px; font-weight: 650; }
.stat-card strong {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-family: inherit;
  font-size: 28px;
  font-weight: 770;
  letter-spacing: -.035em;
}
.content-grid { gap: 17px; }
.panel {
  padding: 24px 25px;
  border-color: #e6e9f0;
  border-radius: 15px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 5px 18px rgba(30,41,59,.025);
}
.panel-head { margin-bottom: 16px; }
.panel h3, .panel-head h3 {
  font-family: inherit;
  font-size: 19px;
  font-weight: 740;
  letter-spacing: -.025em;
}
.text-btn, .back-btn { color: #5556d4; font-size: 12px; }
.mini-row {
  min-height: 68px;
  align-items: center;
  padding: 14px 3px;
  border-color: #edf0f4;
}
.mini-row strong { font-size: 13px; }
.mini-row span { color: #929aac; }
.money { color: #3f43b9; font-weight: 780; }

/* Toolbars, cards and tables */
.toolbar {
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 13px;
  border: 1px solid #e5e8ef;
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 4px 14px rgba(31,41,69,.025);
}
.search-box span { top: 8px; color: #9ba3b3; }
.search-box input, .toolbar select {
  border-color: transparent;
  background: #f5f6f9;
}
.toolbar select { color: #596277; }
input, select, textarea {
  border-color: #dfe3eb;
  border-radius: 9px;
  color: #242c3f;
  background: #fbfcfd;
}
input::placeholder, textarea::placeholder { color: #a8afbc; }
input:focus, select:focus, textarea:focus {
  border-color: #7775e7;
  background: white;
  box-shadow: 0 0 0 3px rgba(91,92,226,.1);
}
.card-list { gap: 10px; }
.customer-card {
  min-height: 92px;
  align-items: center;
  padding: 20px 21px;
  border-color: #e6e9f0;
  border-radius: 14px;
  background: rgba(255,255,255,.96);
}
.customer-card:hover {
  border-color: #d7d9f3;
  box-shadow: 0 13px 30px rgba(35,42,73,.075);
  transform: translateY(-2px);
}
.avatar {
  flex-basis: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6d6ce8, #4c4fc3);
  box-shadow: 0 8px 18px rgba(79,70,209,.18);
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
}
.customer-card h3 { color: #252d40; font-size: 15px; }
.meta-line { gap: 7px 22px; color: #858da0; font-size: 12px; }
.tag {
  margin-left: 6px;
  padding: 4px 8px;
  color: #5556c7;
  background: #eeeeff;
  font-size: 10px;
}
.small-btn {
  min-height: 34px;
  padding: 0 11px;
  border-color: #e0e4eb;
  border-radius: 8px;
  color: #515b70;
  background: white;
  font-size: 12px;
}
.small-btn:hover { border-color: #c8caeb; color: #4c4dcc; background: #f8f8ff; }
.danger-btn { color: #d24962; }
.danger-btn:hover { border-color: #f2ccd4; color: #c93751; background: #fff7f8; }
.order-table-wrap {
  border-color: #e4e7ee;
  border-radius: 14px;
  background: white;
  box-shadow: 0 4px 16px rgba(31,41,69,.025);
}
table { min-width: 900px; }
th {
  padding: 14px 16px;
  color: #828a9c;
  background: #f7f8fa;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
}
td {
  padding: 17px 16px;
  border-color: #edf0f4;
  color: #4d566a;
  font-size: 12px;
  line-height: 1.55;
}
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fafaff; }
td strong { color: #252d40; }

/* Customer detail */
.back-btn { margin-bottom: 4px; }
.detail-head {
  position: relative;
  overflow: hidden;
  align-items: center;
  margin: 13px 0 17px;
  padding: 30px 31px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 17px;
  background:
    radial-gradient(circle at 88% 30%, rgba(112,105,255,.35), transparent 24%),
    linear-gradient(120deg, #171d35, #252c52);
  box-shadow: 0 16px 35px rgba(28,35,70,.13);
}
.detail-head::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -50px;
  bottom: -115px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
}
.detail-head h2 {
  margin-bottom: 7px;
  font-family: inherit;
  font-size: 27px;
  font-weight: 750;
}
.detail-head span { color: #aeb7ce; font-size: 12px; }
.detail-actions { position: relative; z-index: 1; }
.detail-actions .small-btn {
  border-color: rgba(255,255,255,.12);
  color: #eef0f8;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
}
.detail-actions .small-btn:hover { background: rgba(255,255,255,.15); }
.detail-grid { gap: 17px; }
.info-item { padding: 15px 0; border-color: #edf0f4; }
.info-item label { color: #979fb0; font-weight: 750; letter-spacing: .04em; }
.info-item strong { color: #31394c; font-size: 13px; }
.info-item p { margin-bottom: 2px; font-size: 12px; line-height: 1.65; }

/* Modal and forms */
.modal {
  padding: 26px;
  background: rgba(12, 18, 35, .68);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(840px, 100%);
  max-height: 90vh;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 38px 110px rgba(5,10,25,.35);
}
.modal-head {
  padding: 24px 29px 19px;
  border-color: #e8ebf0;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
}
.modal-head h3 {
  font-family: inherit;
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -.025em;
}
.modal-head .icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: #737c8f;
  background: #f3f4f7;
  font-size: 22px;
}
#modalForm { padding: 25px 29px 29px; }
label { color: #5d6679; font-size: 12px; font-weight: 700; }
input, select { height: 45px; }
textarea { min-height: 96px; }
.form-grid { gap: 16px; }
.repeat-block {
  margin-top: 19px;
  padding: 18px;
  border-color: #e4e7ee;
  border-radius: 12px;
  background: #f8f9fb;
}
.repeat-head strong { color: #3b4356; font-size: 13px; }
.repeat-item { gap: 10px; }
.remove-row {
  color: #cf5369;
  background: #fff0f2;
}
.form-actions { border-color: #e8ebf0; }
.toast {
  padding: 12px 19px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: #1b2236;
  box-shadow: 0 12px 35px rgba(0,0,0,.25);
}
.empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  color: #9ba3b2;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  main { padding-inline: 25px; }
  .hero { padding: 34px; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { width: 256px; left: -275px; }
  main { padding: 0 18px 38px; }
  .topbar { min-height: 80px; }
  .page { padding-top: 20px; }
  .menu-btn {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    height: 40px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 3px 10px rgba(31,41,69,.06);
  }
  .content-grid, .detail-grid { grid-template-columns: 1fr; }
  .header-actions #restoreBtn { display: none; }
}

@media (max-width: 600px) {
  body { background: #f4f6fa; }
  .login-shell { padding: 15px; }
  .login-card { padding: 40px 23px 30px; border-radius: 22px; }
  .login-card::before { top: 19px; right: 20px; }
  .login-card h1 { font-size: 29px; }
  .password-row { gap: 9px; }
  .password-row .primary { min-height: 48px; }
  main { padding: 0 14px 32px; }
  .topbar { min-height: 76px; gap: 11px; }
  .topbar .eyebrow { display: none; }
  .topbar h2 { font-size: 21px; }
  .header-actions .primary { min-height: 40px; padding: 0 13px; }
  .header-actions #exportBtn { display: none; }
  .page { padding-top: 15px; }
  .hero {
    min-height: 260px;
    padding: 28px 23px;
    border-radius: 17px;
  }
  .hero h3 { font-size: 29px; line-height: 1.25; }
  .hero p:last-child { font-size: 13px; line-height: 1.7; }
  .hero .light-btn { margin-top: 22px; }
  .stats-grid { gap: 9px; margin: 12px 0; }
  .stat-card { min-height: 112px; padding: 16px; border-radius: 13px; }
  .stat-card::before { width: 25px; margin-bottom: 14px; }
  .stat-card span { font-size: 11px; }
  .stat-card strong { font-size: clamp(18px, 5.3vw, 23px); }
  .panel { padding: 20px 18px; border-radius: 14px; }
  .toolbar { align-items: stretch; padding: 11px; }
  .toolbar .primary { width: 100%; }
  .customer-card { padding: 18px; }
  .customer-main { align-items: flex-start; }
  .avatar { flex-basis: 43px; height: 43px; border-radius: 12px; }
  .card-actions { padding-top: 2px; }
  .detail-head { padding: 26px 22px; }
  .detail-head h2 { font-size: 24px; }
  .detail-actions { flex-wrap: wrap; }
  .detail-actions .small-btn { flex: 1; }
  .modal { align-items: end; padding: 0; }
  .modal-card {
    width: 100%;
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }
  .modal-head { padding: 20px 20px 16px; }
  #modalForm { padding: 21px 20px 26px; }
  .repeat-block { padding: 14px; }
  .form-actions { position: sticky; bottom: -26px; z-index: 2; margin-inline: -20px; padding: 16px 20px 20px; background: white; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
