:root {
  color-scheme: light;
  --ink: #183549;
  --muted: #70838d;
  --brand: #12736d;
  --brand-dark: #0b5754;
  --brand-soft: #e4f4f0;
  --canvas: #f2f6f5;
  --surface: #fff;
  --line: #e4ecea;
  --warning: #9a6720;
  --danger: #a4423c;
  --success: #14786f;
  --shadow: 0 18px 45px rgba(20, 62, 64, .08);
  --radius: 18px;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1080px; min-height: 100dvh; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.is-hidden { display: none !important; }

.login-view { display: grid; grid-template-columns: minmax(560px, 1.18fr) minmax(440px, .82fr); min-height: 100dvh; background: #f8fbfa; }
.login-visual { position: relative; display: flex; flex-direction: column; min-height: 100dvh; padding: 42px 54px; color: #fff; background: linear-gradient(145deg, #0a4f50, #11776f 55%, #36a89d); overflow: hidden; }
.login-visual::before { content: ""; position: absolute; width: 620px; height: 620px; right: -260px; top: -240px; border-radius: 50%; border: 95px solid rgba(255,255,255,.055); }
.login-visual::after { content: ""; position: absolute; width: 360px; height: 360px; left: -220px; bottom: -210px; border-radius: 50%; border: 65px solid rgba(255,255,255,.05); }
.login-brand { position: relative; z-index: 1; display: grid; grid-template-columns: 44px auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.login-brand > span { grid-row: 1/3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px 14px 21px 21px; color: var(--brand-dark); background: #d9f6ef; font-weight: 900; }
.login-brand strong { align-self: end; font-size: 18px; letter-spacing: .06em; }
.login-brand small { align-self: start; color: rgba(255,255,255,.65); font-size: 10px; }
.login-message { position: relative; z-index: 1; width: min(640px, 88%); margin: auto; }
.login-message > p { margin: 0 0 12px; color: #a7e6dd; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.login-message h1 { margin: 0; font-size: clamp(38px, 4.2vw, 62px); line-height: 1.15; letter-spacing: -.055em; }
.visual-card { display: grid; grid-template-columns: 180px 1fr; align-items: center; width: min(540px, 100%); height: 170px; margin-top: 45px; padding: 0 25px 0 8px; border: 1px solid rgba(255,255,255,.18); border-radius: 26px; background: rgba(255,255,255,.1); backdrop-filter: blur(12px); }
.visual-card img { width: 190px; height: 160px; object-fit: contain; transform: translateY(12px); }
.visual-card strong { display: block; margin-bottom: 8px; font-size: 18px; }
.visual-card span { color: rgba(255,255,255,.68); font-size: 12px; line-height: 1.7; }
.login-foot { position: relative; z-index: 1; color: rgba(255,255,255,.46); font-size: 10px; }
.login-panel { display: grid; place-items: center; padding: 40px; }
.login-card { width: min(390px, 100%); }
.mobile-brand { display: none; }
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.login-card h2 { margin: 9px 0 8px; font-size: 32px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); font-size: 13px; }
.login-card label { display: grid; gap: 8px; margin: 17px 0; font-size: 12px; font-weight: 700; }
.login-card input { height: 52px; padding: 0 15px; border: 1px solid var(--line); border-radius: 14px; outline: 0; color: var(--ink); background: #fff; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(18,115,109,.11); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; font-size: 12px; font-weight: 750; cursor: pointer; }
.button.primary { color: #fff; background: var(--brand); box-shadow: 0 10px 24px rgba(18,115,109,.17); }
.button.ghost { color: var(--brand); border-color: var(--line); background: #fff; }
.button.danger { color: var(--danger); border-color: #f0d8d5; background: #fff7f6; }
.button.small { min-height: 32px; padding: 0 11px; border-radius: 10px; font-size: 11px; }
.button.wide { width: 100%; min-height: 52px; margin-top: 8px; }
.button:disabled { color: #9aabaa; background: #e5eeec; box-shadow: none; cursor: not-allowed; }
.demo-account { display: grid; gap: 5px; margin-top: 22px; padding: 13px 15px; border-radius: 14px; color: var(--muted); background: var(--brand-soft); font-size: 10px; }
.demo-account strong { color: var(--brand-dark); font-size: 11px; }

.admin-shell { display: grid; grid-template-columns: 238px 1fr; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; padding: 24px 16px 18px; color: #dcebea; background: #103f4e; }
.side-brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 30px; color: #fff; text-decoration: none; }
.side-brand > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px 13px 19px 19px; color: var(--brand-dark); background: #d8f6ef; font-weight: 900; }
.side-brand strong { display: block; font-size: 16px; letter-spacing: .04em; }
.side-brand small { color: #83aaa9; font-size: 9px; }
.side-nav { display: grid; gap: 5px; }
.side-link { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 0 13px; border: 0; border-radius: 12px; color: #a8c1c2; text-align: left; background: transparent; font-size: 12px; cursor: pointer; }
.side-link span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; color: #b8d2d1; background: rgba(255,255,255,.06); font-weight: 800; }
.side-link.is-active { color: #fff; background: rgba(255,255,255,.1); }
.side-link.is-active span { color: var(--brand-dark); background: #d8f6ef; }
.sidebar-note { margin-top: auto; padding: 14px; border-radius: 14px; color: #a7c1c1; background: rgba(255,255,255,.055); font-size: 10px; line-height: 1.7; }
.sidebar-note strong { color: #e4f0ef; font-size: 11px; }
.sidebar-note p { margin: 5px 0 0; }
.side-user { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 10px 7px; border-top: 1px solid rgba(255,255,255,.08); }
.user-avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 12px; color: var(--brand-dark); background: #d8f6ef; font-weight: 800; }
.side-user strong { display: block; color: #fff; font-size: 11px; }
.side-user small { color: #7f9fa1; font-size: 9px; }
.side-user button { margin-left: auto; border: 0; color: #87a6a8; background: transparent; cursor: pointer; }

.workspace { min-width: 0; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 14px 30px; border-bottom: 1px solid var(--line); background: rgba(244,247,246,.92); backdrop-filter: blur(15px); }
.topbar h1 { margin: 0 0 3px; font-size: 21px; letter-spacing: -.025em; }
.topbar p { margin: 0; color: var(--muted); font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.today { padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.mobile-menu { display: none; }
.workspace-content { padding: 26px 30px 45px; }
.admin-loading { display: grid; place-items: center; padding: 30vh 0; color: var(--muted); }
.admin-loading span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: #fff; background: var(--brand); font-weight: 800; }
.admin-loading p { font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric { position: relative; min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 24px rgba(26,67,67,.035); overflow: hidden; }
.metric.is-brand { color: #fff; background: linear-gradient(135deg, #0c5b58, #169188); border-color: transparent; }
.metric::after { content: ""; position: absolute; width: 90px; height: 90px; right: -33px; top: -36px; border-radius: 50%; border: 18px solid rgba(18,115,109,.06); }
.metric.is-brand::after { border-color: rgba(255,255,255,.08); }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.metric.is-brand .metric-head { color: rgba(255,255,255,.72); }
.metric-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.metric.is-brand .metric-icon { color: #fff; background: rgba(255,255,255,.14); }
.metric strong { display: block; margin: 14px 0 3px; font-size: 31px; letter-spacing: -.04em; }
.metric p { margin: 0; color: var(--muted); font-size: 10px; }
.metric.is-brand p { color: rgba(255,255,255,.65); }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 24px rgba(26,67,67,.035); }
.panel-header { display: flex; align-items: center; justify-content: space-between; min-height: 65px; padding: 14px 19px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0 0 3px; font-size: 14px; }
.panel-header p { margin: 0; color: var(--muted); font-size: 9px; }
.panel-body { padding: 17px 19px; }
.type-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.type-card { min-height: 130px; padding: 15px; border-radius: 16px; background: #f5f9f8; }
.type-card:nth-child(2) { background: #f1f6fb; }
.type-card:nth-child(3) { background: #f5f8ed; }
.type-card:nth-child(4) { background: #fff8ec; }
.type-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 13px; color: var(--brand-dark); background: #dff3ef; font-family: "STKaiti", "KaiTi", serif; font-size: 20px; font-weight: 800; }
.type-card strong { display: block; margin-top: 16px; font-size: 23px; }
.type-card p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.flow-list { display: grid; gap: 10px; }
.flow-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; }
.flow-item > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.flow-item strong { display: block; font-size: 11px; }
.flow-item small { color: var(--muted); font-size: 9px; }
.flow-item b { color: var(--brand); font-size: 11px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.search-control { position: relative; width: min(410px, 45vw); }
.search-control input { width: 100%; height: 42px; padding: 0 40px 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: #fff; }
.search-control input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(18,115,109,.09); }
.search-control button { position: absolute; right: 5px; top: 5px; width: 32px; height: 32px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); cursor: pointer; }
.filter-select { height: 42px; padding: 0 34px 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; }
.toolbar-summary { margin-left: auto; color: var(--muted); font-size: 10px; }

.data-panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { height: 44px; padding: 0 15px; color: #7b8e96; text-align: left; background: #f7f9f9; font-size: 9px; font-weight: 700; }
.data-table td { padding: 13px 15px; border-top: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #fbfdfc; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.table-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; overflow: hidden; border-radius: 11px; color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
.table-avatar.is-image { display: block; object-fit: cover; }
.person-cell strong { display: block; font-size: 11px; }
.person-cell small { color: var(--muted); font-size: 9px; }
.progress-dots { display: flex; align-items: center; gap: 5px; }
.progress-dots span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 9px; color: #91a0a4; background: #eff3f2; font-family: "STKaiti", "KaiTi", serif; font-size: 11px; font-weight: 800; }
.progress-dots span.is-done { color: #fff; background: var(--brand); }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 9px; color: var(--success); background: var(--brand-soft); font-size: 9px; font-weight: 700; }
.status.warning { color: var(--warning); background: #fff4dd; }
.status.muted { color: #7d8d91; background: #eff3f2; }
.status.danger { color: var(--danger); background: #fff0ee; }
.image-thumb { width: 45px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--brand-soft); cursor: zoom-in; }
.text-button { padding: 5px 0; border: 0; color: var(--brand); background: transparent; font-size: 10px; font-weight: 750; cursor: pointer; }
.text-button.danger { color: var(--danger); }
.action-list { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; min-width: 138px; }
.current-account { color: var(--muted); font-size: 9px; }
.binding-state { display: grid; gap: 5px; }
.binding-state small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.binding-help { margin-top: 14px; padding: 14px 16px; border: 1px solid #eadadd; border-radius: 14px; color: var(--muted); background: #fff7f7; }
.binding-help strong { color: var(--ink); font-size: 11px; }
.binding-help p { margin: 5px 0 0; font-size: 10px; line-height: 1.65; }
.empty-row { padding: 55px !important; text-align: center; color: var(--muted); }

.admin-dialog { width: min(760px, 92vw); max-height: 88dvh; padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: #f8fbfa; box-shadow: var(--shadow); overflow: auto; }
.admin-dialog::backdrop { background: rgba(10,37,48,.48); backdrop-filter: blur(3px); }
.dialog-shell { padding: 24px; }
.dialog-top { display: flex; align-items: start; justify-content: space-between; margin-bottom: 18px; }
.dialog-top h2 { margin: 3px 0 4px; font-size: 21px; }
.dialog-top p { margin: 0; color: var(--muted); font-size: 10px; }
.dialog-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 11px; color: var(--muted); background: #eaf0ef; font-size: 18px; cursor: pointer; }
.patient-hero { display: flex; align-items: center; gap: 13px; padding: 17px; border-radius: 17px; color: #fff; background: linear-gradient(135deg, #103f4e, #147a73); }
.patient-hero .table-avatar { width: 48px; height: 48px; color: var(--brand-dark); background: #d9f6ef; font-size: 17px; }
.patient-hero h3 { margin: 0 0 4px; }
.patient-hero p { margin: 0; color: rgba(255,255,255,.65); font-size: 10px; }
.hero-score { margin-left: auto; text-align: right; }
.hero-score strong { display: block; font-size: 24px; }
.hero-score small { color: rgba(255,255,255,.64); font-size: 9px; }
.edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.edit-grid label, .employee-form label { display: grid; gap: 6px; color: var(--muted); font-size: 9px; }
.edit-grid input, .employee-form input, .employee-form select { height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: #fff; }
.dialog-section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.dialog-section-title h3 { margin: 0; font-size: 13px; }
.checkin-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.gallery-card { padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.gallery-card img, .gallery-empty { display: grid; place-items: center; width: 100%; aspect-ratio: 1.25; border-radius: 10px; object-fit: cover; background: var(--brand-soft); }
.gallery-empty { color: #93a5a7; font-family: "STKaiti", "KaiTi", serif; font-size: 24px; }
.gallery-card strong { display: block; margin-top: 7px; font-size: 10px; }
.gallery-card small { color: var(--muted); font-size: 8px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }
.image-preview { display: block; width: 100%; max-height: 70dvh; border-radius: 16px; object-fit: contain; background: #e9f1ef; }
.employee-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.employee-form .full { grid-column: 1 / -1; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-card { overflow: hidden; }
.settings-form { display: grid; gap: 15px; }
.settings-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.settings-form input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: #fff; }
.settings-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(18,115,109,.09); }
.form-help { margin: -3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.settings-form .button { justify-self: start; min-width: 150px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; padding: 11px 16px; transform: translate(-50%, 18px); border-radius: 12px; color: #fff; background: rgba(8,42,50,.92); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-layout { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

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