/* Porcelain Clinic Desk — AI美诊 admin */
:root {
  --ink: #1a2228;
  --ink-soft: #3d4750;
  --muted: #6b757e;
  --line: #ddd8d1;
  --paper: #f3f1ee;
  --paper-deep: #ebe7e1;
  --surface: #faf9f7;
  --rose: #a85b5b;
  --rose-deep: #8f4848;
  --champagne: #b89a6c;
  --sage: #4f7165;
  --danger: #b54a4a;
  --shadow: 0 18px 40px rgba(26, 34, 40, 0.08);
  --radius: 14px;
  --nav-w: 248px;
  --font: "Be Vietnam Pro", "Noto Sans SC", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(184, 154, 108, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(168, 91, 91, 0.08), transparent 50%),
    linear-gradient(180deg, #f7f5f2 0%, var(--paper) 40%, #efece7 100%);
  background-attachment: fixed;
}

::selection {
  background: rgba(168, 91, 91, 0.18);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

#app {
  min-height: 100vh;
}

/* —— Login —— */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px 28px;
  position: relative;
  background-color: #ebe4dc;
  background-image:
    linear-gradient(180deg, rgba(250, 249, 247, 0.48) 0%, rgba(243, 241, 238, 0.7) 55%, rgba(235, 228, 220, 0.8) 100%),
    url("../img/login-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-card {
  width: min(420px, 100%);
  background: rgba(250, 249, 247, 0.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 40px 36px 28px;
  position: relative;
  overflow: hidden;
  animation: rise 0.55s var(--ease) both;
  backdrop-filter: blur(10px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--rose), var(--champagne), transparent 80%);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-glyph {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: #f7f3ee;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 13px;
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-title {
  margin: 0 0 28px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.field input:focus {
  border-color: rgba(168, 91, 91, 0.55);
  box-shadow: 0 0 0 3px rgba(168, 91, 91, 0.12);
}

.field input::placeholder {
  color: #9aa3ab;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 14.5px;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), opacity 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  background: var(--ink);
  color: #f7f3ee;
}

.btn-primary:hover:not(:disabled) {
  background: #10161b;
}

.btn-ghost {
  height: 36px;
  padding: 0 12px;
  color: var(--ink-soft);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(26, 34, 40, 0.04);
}

.btn-soft {
  height: 36px;
  padding: 0 12px;
  background: var(--paper-deep);
  color: var(--ink);
  border-radius: 9px;
}

.btn-soft:hover {
  background: #e3ddd4;
}

.form-error {
  min-height: 20px;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 13px;
}

.login-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* —— App shell —— */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: 1fr auto;
}

.nav {
  grid-row: 1 / 2;
  background: rgba(250, 249, 247, 0.92);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.nav-brand .brand-glyph {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 11px;
}

.nav-brand strong {
  display: block;
  font-size: 14px;
}

.nav-brand span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s var(--ease), color 0.15s;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
}

.nav-link:hover {
  background: rgba(26, 34, 40, 0.04);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--ink);
  color: #f7f3ee;
}

.nav-link.is-active svg {
  opacity: 1;
}

.nav-spacer {
  flex: 1;
}

.nav-user {
  padding: 12px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.nav-user strong {
  display: block;
  font-size: 13px;
}

.nav-user span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.main {
  min-width: 0;
  padding: 28px 32px 40px;
  animation: rise 0.4s var(--ease) both;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search {
  height: 38px;
  width: min(260px, 100%);
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
}

.search:focus {
  border-color: rgba(168, 91, 91, 0.45);
  box-shadow: 0 0 0 3px rgba(168, 91, 91, 0.1);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(26, 34, 40, 0.04);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-pad {
  padding: 20px 22px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -24px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 154, 108, 0.16), transparent 70%);
  pointer-events: none;
}

.metric .label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.metric .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric .delta {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--sage);
}

.metric .delta.is-down {
  color: var(--rose);
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
}

.list-quiet {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-quiet li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}

.list-quiet li:first-child {
  border-top: 0;
  padding-top: 0;
}

.list-quiet .meta {
  color: var(--muted);
  font-size: 12.5px;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.data th,
table.data td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(243, 241, 238, 0.7);
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr {
  transition: background 0.12s;
}

table.data tbody tr:hover {
  background: rgba(243, 241, 238, 0.55);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill-ok {
  background: rgba(79, 113, 101, 0.12);
  color: var(--sage);
}

.pill-warn {
  background: rgba(184, 154, 108, 0.18);
  color: #7a6438;
}

.pill-mute {
  background: rgba(26, 34, 40, 0.06);
  color: var(--ink-soft);
}

.pill-rose {
  background: rgba(168, 91, 91, 0.12);
  color: var(--rose-deep);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 28px;
  z-index: 50;
  background: var(--ink);
  color: #f7f3ee;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: rise 0.25s var(--ease);
}

.settings-grid {
  display: grid;
  gap: 0;
}

.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.settings-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.settings-row strong {
  display: block;
  font-size: 14px;
}

.settings-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d5d0c8;
  position: relative;
  transition: background 0.18s;
}

.toggle.is-on {
  background: var(--sage);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle.is-on::after {
  transform: translateX(18px);
}

/* —— ICP —— */
.icp-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 14px 16px 18px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  background: rgba(243, 241, 238, 0.85);
}

.icp-bar a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.icp-bar a:hover {
  color: var(--ink);
  border-bottom-color: currentColor;
}

.login-foot .icp-bar {
  border: 0;
  background: transparent;
  padding: 0;
  justify-content: flex-start;
  gap: 6px 14px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .nav-spacer {
    display: none;
  }

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-link {
    height: 36px;
    font-size: 13px;
  }

  .nav-user {
    margin-top: 8px;
  }

  .main {
    padding: 20px 16px 32px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
