/* ============================================================
   iPowerClinic — dark clinic UI
   ============================================================ */

:root {
  --bg:        #0a1524;
  --bg-deep:   #07111d;
  --panel:     #101f33;
  --panel-2:   #0c1826;
  --line:      #1d2f47;
  --line-soft: #17283d;
  --text:      #e8eef8;
  --muted:     #8ba0ba;
  --muted-2:   #67798f;
  --accent:    #f97316;
  --accent-2:  #fb923c;
  --blue:      #3b82f6;
  --green:     #22c55e;
  --amber:     #f59e0b;
  --radius:    10px;
  --radius-sm: 8px;
  --shadow:    0 24px 60px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button { font: inherit; color: inherit; }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- brand ---------- */

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent-2), #ea580c);
  box-shadow: 0 4px 14px rgba(249, 115, 22, .35);
  flex: 0 0 auto;
}

.brand-mark svg { width: 20px; height: 20px; fill: #fff; stroke: none; }

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-text strong { font-size: 17px; letter-spacing: -.2px; }

.brand-text em {
  font-style: normal;
  font-size: 8.5px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.brand-sm .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.brand-sm .brand-mark svg { width: 17px; height: 17px; }

/* 真实 logo（橙色心跳图标）。透明底，深浅背景都适用 */
.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-sm .brand-logo { width: 30px; height: 30px; border-radius: 8px; }

/* ---------- pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.pill-beta {
  align-self: flex-start;
  margin: 18px 0 14px;
  padding: 3px 9px;
  font-size: 9.5px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #9fb0c6;
  background: rgba(148, 163, 184, .12);
  border-color: rgba(148, 163, 184, .22);
}

.pill-branch { color: #c8d6e8; border-color: var(--line-2); background: rgba(59, 130, 246, .08); }

.pill-ghost { background: rgba(255, 255, 255, .03); }

.pill-user { color: var(--text); background: rgba(255, 255, 255, .04); }

.pill-icon { width: 13px; height: 13px; }

/* ============================================================
   LOGIN
   ============================================================ */

body.auth {
  background:
    radial-gradient(circle at 20% 15%, rgba(59, 130, 246, .10), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(249, 115, 22, .08), transparent 45%),
    var(--bg-deep);
}

body.auth::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 372px;
  padding: 26px 26px 18px;
  background: linear-gradient(180deg, #111f33, #0d1a2b);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.auth-title { margin: 0 0 4px; font-size: 20px; letter-spacing: -.2px; }

.auth-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--muted-2); }

.auth-error {
  margin: 0 0 14px;
  padding: 9px 11px;
  font-size: 12px;
  color: #fecaca;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .3);
  border-radius: var(--radius-sm);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label { font-size: 11.5px; color: var(--muted); }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 38px 0 34px;
  color: var(--text);
  background: #0b1726;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.input-wrap input::placeholder { color: #4f6379; }

.input-wrap input:focus {
  border-color: rgba(59, 130, 246, .6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}

.input-action {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted-2);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.input-action:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.input-action svg { width: 15px; height: 15px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  margin-top: 2px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter .15s, transform .1s;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-icon { width: 15px; height: 15px; }

.auth-foot {
  margin: 18px 0 0;
  font-size: 10.5px;
  text-align: center;
  color: #4a5c72;
}

/* ============================================================
   APP SHELL
   ============================================================ */

body.app { background: var(--bg); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 16px;
  background: #0c1929;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-left,
.topbar-right { display: flex; align-items: center; gap: 10px; }

.topbar-sep { width: 1px; height: 20px; background: var(--line); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.icon-btn svg { width: 16px; height: 16px; }

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 42px;
  padding: 0 16px;
  background: #0b1626;
  border-bottom: 1px solid var(--line-soft);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px;
  font-size: 12.5px;
  color: var(--muted);
  border-radius: 7px;
  transition: background .15s, color .15s;
}

.tab svg { width: 15px; height: 15px; }

.tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }

.tab.is-active {
  color: #1a1206;
  font-weight: 600;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
}

.shell { display: flex; min-height: calc(100vh - 94px); }

.rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 50px;
  padding: 10px 7px;
  background: #0a1421;
  border-right: 1px solid var(--line-soft);
}

.rail-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  color: var(--muted-2);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.rail-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.rail-btn.is-active { color: #fff; background: rgba(59, 130, 246, .18); }
.rail-btn svg { width: 17px; height: 17px; }

.page {
  flex: 1;
  min-width: 0;
  padding: 22px 24px 16px;
}

.page-head { margin-bottom: 20px; }

.page-head h1 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -.3px;
}

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

/* ---------- stat cards ---------- */

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

.stat {
  padding: 14px 16px 15px;
  background: linear-gradient(180deg, #102033, #0d1a2a);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .1px;
}

.stat-icon { color: var(--muted-2); display: grid; place-items: center; }
.stat-icon svg { width: 15px; height: 15px; }

.stat-eye {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted-2);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.stat-eye:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.stat-eye svg { width: 14px; height: 14px; }

.stat-value {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}

.stat-note { margin: 5px 0 0; font-size: 11px; color: var(--muted-2); }

.stat-revenue .stat-value { color: #eafff3; }
.stat-new .stat-value { color: #eaf2ff; }
.stat-appointments .stat-value { color: #eaf2ff; }
.stat-active .stat-value { color: #eaf2ff; }

/* ---------- panels ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.panel {
  background: linear-gradient(180deg, #0f1e30, #0c1826);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1px;
}

.panel-tools {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--muted-2);
}

.panel-tools svg { width: 11px; height: 11px; }
.panel-tools a { color: var(--blue); }

/* ---------- quick actions ---------- */

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.action {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  transition: background .15s, border-color .15s, transform .1s;
}

.action:hover {
  background: rgba(59, 130, 246, .1);
  border-color: rgba(59, 130, 246, .35);
  transform: translateY(-1px);
}

.action-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: #cfe0f7;
  background: rgba(59, 130, 246, .14);
  border-radius: 8px;
}

.action-icon svg { width: 16px; height: 16px; }

.action-text { display: flex; flex-direction: column; min-width: 0; }

.action-text strong { font-size: 12.5px; font-weight: 600; }

.action-text em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-go { width: 13px; height: 13px; margin-left: auto; color: var(--muted-2); flex: 0 0 auto; }

/* ---------- appointments ---------- */

.appt-list { list-style: none; margin: 0; padding: 6px 16px 12px; }

.appt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}

.appt:last-child { border-bottom: 0; }

.appt-time {
  width: 62px;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.appt-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }

.appt-main strong { font-size: 12.5px; font-weight: 600; }

.appt-main em { font-style: normal; font-size: 10.5px; color: var(--muted-2); }

.badge {
  padding: 3px 8px;
  font-size: 9.5px;
  letter-spacing: .6px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-muted {
  color: #b9c6d6;
  background: rgba(148, 163, 184, .14);
  border: 1px solid rgba(148, 163, 184, .22);
}

/* ---------- shortcuts ---------- */

.shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 18px;
  padding: 14px 16px 18px;
}

.shortcut-col h3 {
  margin: 0 0 9px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.shortcut-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.shortcut-col a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  margin-left: -7px;
  font-size: 12px;
  color: #c3d2e4;
  border-radius: 6px;
  transition: background .15s, color .15s;
}

.shortcut-col a:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.shortcut-col svg { width: 14px; height: 14px; color: var(--muted-2); flex: 0 0 auto; }

/* ---------- footer ---------- */

.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  font-size: 10.5px;
  color: #4f6379;
  border-top: 1px solid var(--line-soft);
}

.page-ver { color: #405469; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .rail { display: none; }
  .page { padding: 18px 16px 14px; }
  .stats { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .shortcuts { grid-template-columns: 1fr; }
  .pill-ghost, .topbar-sep { display: none; }
  .page-head h1 { font-size: 18px; }
}
