:root {
  --ink: #22221f;
  --graphite: #282825;
  --graphite-soft: #383834;
  --paper: #f5f3ed;
  --panel: #ffffff;
  --line: #e5e1d8;
  --muted: #72716b;
  --faint: #aaa79d;
  --orange: #c85421;
  --orange-dark: #a83e14;
  --orange-pale: #fff0e9;
  --green: #276749;
  --green-pale: #e9f5ed;
  --red: #b0362d;
  --red-pale: #fff0ee;
  --amber: #9a5a06;
  --amber-pale: #fff5df;
  --shadow: 0 15px 40px rgba(34, 34, 31, .08);
  --radius: 12px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
:focus-visible { outline: 3px solid rgba(200, 84, 33, .42); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: -4rem; left: 1rem; padding: .6rem .9rem; color: #fff; background: var(--orange-dark); border-radius: 0 0 7px 7px; transition: top .15s; }
.skip-link:focus { top: 0; }
.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr) 248px; min-height: 100vh; }
.sidebar { z-index: 20; display: flex; flex-direction: column; min-height: 100vh; padding: 28px 16px 21px; color: #f8f7f4; background: var(--graphite); }
.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 38px; padding: 0 6px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: white; text-decoration: none; font-size: 21px; font-weight: 760; letter-spacing: -.035em; }
.brand img { display: block; width: 31px; height: 31px; }
.sidebar-caption, .eyebrow { margin: 0; color: var(--faint); font-size: 10px; font-weight: 750; letter-spacing: .12em; line-height: 1.3; }
.sidebar-caption { padding: 0 10px 9px; color: #96958e; }
.nav-list { display: grid; gap: 3px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 0 10px; color: #bebdb6; border: 0; border-radius: 7px; background: transparent; font-weight: 620; text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.is-active { color: white; background: var(--graphite-soft); }
.nav-marker { width: 6px; height: 6px; border-radius: 50%; background: #7a7973; transition: background .15s, transform .15s; }
.nav-item.is-active .nav-marker { background: var(--orange); transform: scale(1.25); }
.sidebar-foot { margin-top: auto; padding: 17px 10px 0; border-top: 1px solid #42423e; }
.scope-note { display: grid; gap: 3px; color: #a6a59e; font-size: 11px; }
.scope-note strong { color: #e4e2db; font-size: 11px; font-weight: 600; }
.help-link { margin-top: 12px; padding: 0; color: #d3d1ca; border: 0; background: transparent; font-size: 12px; text-decoration: underline; text-decoration-color: #706f69; text-underline-offset: 3px; }
.help-link:hover { color: white; }
.workspace { min-width: 0; }
.topbar { display: flex; min-height: 112px; align-items: center; justify-content: space-between; gap: 24px; padding: 21px 38px 19px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.4); }
.topbar-title { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: 13px; }
.topbar .eyebrow { margin-bottom: 6px; color: #85837c; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 27px; line-height: 1.2; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 16px; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 14px; }
.page-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; min-width: 0; }
.visitor-ip-widget { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; min-width: 0; padding: 4px 7px; color: #59574f; border: 1px solid #ded9cf; border-radius: 7px; background: rgba(255,255,255,.72); font-size: 11px; line-height: 1.35; }
.visitor-ip-label { color: var(--muted); font-weight: 680; white-space: nowrap; }
.visitor-ip-value { min-width: 0; color: var(--ink); font-size: 12px; font-weight: 720; overflow-wrap: anywhere; }
.visitor-ip-action { min-height: 24px; padding: 2px 6px; color: #5e4314; border: 1px solid #e1c8b6; border-radius: 5px; background: #fffaf6; font-size: 10px; font-weight: 720; white-space: nowrap; }
.visitor-ip-action:not(:disabled):hover { border-color: #c58b6c; background: var(--orange-pale); }
.visitor-ip-status { flex-basis: 100%; color: var(--muted); font-size: 10px; }
.visitor-ip-widget[data-state="failed"] { border-color: #edc8c4; background: #fff8f7; }
.visitor-ip-widget[data-state="failed"] .visitor-ip-value { color: var(--red); }
.session-area { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; min-height: 36px; }
.session-loading { color: var(--muted); font-size: 12px; }
.session-user { display: inline-flex; align-items: center; gap: 10px; color: #54534d; font-size: 12px; }
.user-initial { display: inline-grid; width: 31px; height: 31px; place-items: center; color: #573018; border-radius: 50%; background: #f5dfd3; font-size: 12px; font-weight: 800; }
main { padding: 30px 38px 44px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 19px; }
.page-summary { max-width: 530px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.action-cluster { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.button { display: inline-flex; min-height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 7px 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 12px; font-weight: 720; text-decoration: none; transition: transform .12s, border-color .12s, background .12s; }
.button:not(:disabled):hover { border-color: #c8c3b8; transform: translateY(-1px); }
.button-primary { color: white; border-color: var(--orange); background: var(--orange); }
.button-primary:not(:disabled):hover { border-color: var(--orange-dark); background: var(--orange-dark); }
.button-quiet { background: #fff; }
.button-danger { color: #fff; border-color: var(--red); background: var(--red); }
.button-link { min-height: auto; padding: 0; color: var(--orange-dark); border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.icon-button { display: inline-grid; width: 33px; height: 33px; place-items: center; padding: 0; color: var(--ink); border: 1px solid transparent; border-radius: 7px; background: transparent; font-size: 20px; line-height: 1; }
.icon-button:hover { border-color: var(--line); background: white; }
.menu-button, .close-drawer { display: none; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; margin-bottom: 21px; }
.stat-card { min-height: 105px; padding: 16px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.stat-label { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 720; letter-spacing: .045em; }
.stat-value { margin: 0; color: var(--ink); font-size: 29px; font-weight: 760; letter-spacing: -.055em; line-height: 1; }
.stat-sub { margin: 9px 0 0; color: var(--faint); font-size: 11px; }
.filter-bar { display: grid; grid-template-columns: minmax(150px, 1fr) 190px 150px auto; align-items: end; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: #fbfaf7; }
.filter-field { display: grid; gap: 5px; }
.filter-field label, .form-field label { color: #64635d; font-size: 11px; font-weight: 720; }
input, select { width: 100%; min-height: 37px; padding: 7px 9px; color: var(--ink); border: 1px solid #d9d5cb; border-radius: 6px; background: #fff; }
input::placeholder { color: #aaa79d; }
input:disabled, select:disabled { color: #95928a; background: #f6f4ee; }
.mono { font-family: var(--mono); letter-spacing: -.02em; }
.list-panel, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 1px 0 rgba(34,34,31,.02); }
.list-panel { overflow: hidden; }
.filter-bar + .list-panel { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { padding: 11px 14px; color: var(--muted); border-bottom: 1px solid var(--line); background: #fff; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid #eeeae1; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fffcf9; }
.data-table .actions-cell { text-align: right; white-space: nowrap; }
.table-muted { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 5px; min-height: 23px; padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 720; white-space: nowrap; }
.status::before { width: 5px; height: 5px; border-radius: 50%; content: ""; background: currentColor; }
.status-synced, .status-success { color: var(--green); background: var(--green-pale); }
.status-pending { color: var(--amber); background: var(--amber-pale); }
.status-failed { color: var(--red); background: var(--red-pale); }
.status-removing, .status-removed { color: #696761; background: #f0eee8; }
.empty-state { display: grid; min-height: 255px; place-items: center; padding: 35px 25px; text-align: center; }
.empty-inner { max-width: 390px; }
.empty-kicker { display: inline-grid; width: 38px; height: 38px; place-items: center; margin-bottom: 14px; color: var(--orange-dark); border: 1px solid #ecc1ab; border-radius: 8px; background: var(--orange-pale); font-family: var(--mono); font-size: 17px; font-weight: 700; }
.empty-state h2 { font-size: 17px; }
.empty-state p { margin: 8px auto 16px; color: var(--muted); font-size: 13px; }
.info-strip { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; padding: 11px 13px; color: #6a4c17; border: 1px solid #efdeb4; border-radius: 8px; background: #fff8e8; font-size: 12px; }
.info-strip strong { color: #5e4314; }
.info-strip.error-strip { color: #8f2e29; border-color: #f0c9c5; background: var(--red-pale); }
.info-mark { font-family: var(--mono); font-weight: 800; }
.panel { padding: 18px; }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-copy { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.definition-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; font-weight: 650; }
.inline-form { display: flex; align-items: end; gap: 10px; }
.inline-form .form-field { flex: 1; }
.form-field { display: grid; gap: 6px; }
.field-help { margin: 0; color: var(--faint); font-size: 11px; }
.form-error { margin: 0; color: var(--red); font-size: 12px; }
.zone-id-input { min-width: 0; font-family: var(--mono); }
.login-panel { padding: 26px; border: 1px solid #ead1c4; border-radius: var(--radius); background: linear-gradient(130deg, #fff 0%, #fff8f3 100%); }
.login-panel .panel-head { align-items: center; margin-bottom: 0; }
.login-panel h2 { font-size: 19px; }
.login-panel .button { white-space: nowrap; }
.admin-login-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto; align-items: end; gap: 10px; margin-top: 18px; padding-top: 17px; border-top: 1px solid #eeddd3; }
.admin-login-form .form-field { min-width: 0; }
.admin-login-form .field-help, .admin-login-form .login-status, .admin-login-form .form-error { grid-column: 1 / -1; }
.login-status { margin: 0; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.info-rail { z-index: 10; padding: 28px 21px; border-left: 1px solid var(--line); background: #fbfaf6; }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 21px; }
.rail-head .eyebrow { color: #85837c; }
.rail-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9b6ae; box-shadow: 0 0 0 4px rgba(185,182,174,.18); }
.rail-dot.is-good { background: var(--green); box-shadow: 0 0 0 4px rgba(39,103,73,.12); }
.rail-dot.is-warn { background: var(--orange); box-shadow: 0 0 0 4px rgba(200,84,33,.12); }
.rail-card { padding: 16px 0; border-top: 1px solid var(--line); }
.rail-card h2 { margin-bottom: 7px; font-size: 12px; }
.rail-card p { margin-bottom: 0; font-size: 12px; }
.rail-status { color: var(--ink); font-weight: 720; }
.scope-copy { color: #54534d; line-height: 1.65; }
.large-copy { font-size: 14px; }
.rail-tip { margin-top: 38px; border-bottom: 1px solid var(--line); }
.toast-region { position: fixed; z-index: 90; right: 22px; bottom: 22px; display: grid; gap: 8px; max-width: min(390px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; color: #fff; border-radius: 8px; background: #32322f; box-shadow: 0 12px 30px rgba(34,34,31,.22); font-size: 12px; }
.toast.toast-error { background: #8e302b; }
.toast.toast-warning { color: #512e18; background: #f8d6c3; }
.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(27,27,24,.48); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(500px, 100%); padding: 22px; border: 1px solid rgba(255,255,255,.55); border-radius: 12px; background: white; box-shadow: 0 25px 70px rgba(0,0,0,.25); }
.modal-small { width: min(430px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.modal-header .eyebrow { margin-bottom: 5px; color: var(--orange-dark); }
.modal-copy { color: var(--muted); font-size: 13px; }
.modal form { display: grid; gap: 14px; margin-top: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.remove-target { margin: 16px 0 0; padding: 10px 12px; color: #61341c; border: 1px solid #efd2c1; border-radius: 7px; background: #fff7f1; font-size: 13px; }
.scrim { display: none; }
@media (max-width: 1180px) { .app-shell { grid-template-columns: 214px minmax(0,1fr); } .info-rail { display: none; } }
@media (max-width: 800px) { .app-shell { display: block; } .sidebar { position: fixed; inset: 0 auto 0 0; width: min(278px, 88vw); min-height: 100dvh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 14px 0 34px rgba(0,0,0,.22); } body.drawer-open { overflow: hidden; } body.drawer-open .sidebar { transform: translateX(0); } .scrim { position: fixed; z-index: 15; inset: 0; background: rgba(25,25,23,.42); } body.drawer-open .scrim { display: block; } .menu-button, .close-drawer { display: inline-grid; } .topbar { min-height: 90px; padding: 16px 20px; } main { padding: 24px 20px 36px; } .topbar-title { align-items: flex-start; gap: 8px; } h1 { font-size: 24px; } .session-user > span:not(.user-initial) { display: none; } .page-head { align-items: stretch; flex-direction: column; } .action-cluster { justify-content: flex-start; } .stat-grid { grid-template-columns: 1fr; gap: 8px; } .stat-card { min-height: auto; } .filter-bar { grid-template-columns: 1fr 1fr; border-radius: var(--radius); } .filter-bar .button { grid-column: 1 / -1; } .filter-bar + .list-panel { margin-top: 12px; border-top: 1px solid var(--line); border-radius: var(--radius); } .list-panel { overflow-x: auto; } .data-table { min-width: 650px; } .setting-grid { grid-template-columns: 1fr; } .inline-form { align-items: stretch; flex-direction: column; } .admin-login-form { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .topbar { align-items: flex-start; gap: 12px; padding: 14px 15px; } .topbar-title { flex: 1 1 0; } .page-title-row { align-items: flex-start; } .visitor-ip-widget { flex-basis: 100%; max-width: 100%; } .session-area { margin-top: 3px; } main { padding: 20px 15px 30px; } .topbar .eyebrow { font-size: 9px; } h1 { font-size: 21px; } .filter-bar { grid-template-columns: 1fr; } .modal { padding: 18px; } .modal-actions { flex-wrap: wrap; } .modal-actions .button { flex: 1; } .login-panel { padding: 20px; } }
