:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #68746d;
  --paper: #f4f5f0;
  --panel: #ffffff;
  --line: #dfe4dc;
  --green: #1c6b4a;
  --green-soft: #e5f2eb;
  --amber: #9b6416;
  --amber-soft: #fff4db;
  --shadow: 0 18px 45px rgba(27, 46, 36, 0.08);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(92, 139, 112, 0.16), transparent 30rem),
    linear-gradient(180deg, #f8f8f4, var(--paper));
  min-height: 100vh;
}

.login-shell { min-height: 100vh; display: grid; place-items: center; width: min(100% - 28px, 620px); margin: 0 auto; padding: 42px 0; }
.login-card { width: 100%; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); padding: clamp(24px, 6vw, 44px); }
.login-card h1 { font-size: clamp(2rem, 8vw, 3.6rem); }
.login-card form { margin-top: 26px; }
.terms-row { align-items: start; border: 1px solid var(--line); border-radius: 12px; background: #fafbf8; padding: 13px; line-height: 1.5; }
.account-bar { display: flex; align-items: center; gap: 8px; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 48px 0 72px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow, .section-label { margin: 0 0 8px; color: var(--green); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.055em; }
h2 { margin: 0; font-size: 1.45rem; letter-spacing: -0.025em; }
.lede { max-width: 700px; margin: 18px 0 0; color: var(--muted); font-size: 1.04rem; line-height: 1.65; }
.hero-status { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.badge { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.8); padding: 7px 11px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.badge-safe { color: var(--green); border-color: #b8d9c7; background: var(--green-soft); }

.isolation-card, .panel { border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.isolation-card { display: flex; justify-content: space-between; gap: 28px; padding: 24px 28px; margin-bottom: 22px; }
.isolation-card p:not(.section-label) { color: var(--muted); margin: 10px 0 0; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 12px; min-width: min(570px, 52%); }
.status-grid div { padding: 14px; border-radius: 14px; background: #f7f8f5; }
.status-grid span, .status-grid strong { display: block; }
.status-grid span { color: var(--muted); font-size: .76rem; margin-bottom: 6px; }
.status-grid strong { font-size: .9rem; }
.danger-free { color: var(--green); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .75fr); gap: 22px; }
.panel { padding: 26px; }
.mode-tabs { display: flex; gap: 8px; margin: 22px 0; padding: 5px; border-radius: 14px; background: #f0f2ed; }
.mode-tab { flex: 1; min-height: 42px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.mode-tab.active { color: var(--ink); background: white; box-shadow: 0 4px 12px rgba(0,0,0,.06); }

form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #344039; font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd6ce; border-radius: 11px; background: #fff; padding: 12px 13px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: #5a9576; box-shadow: 0 0 0 3px rgba(54,126,89,.12); }
textarea { resize: vertical; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.mode-fields { display: grid; gap: 15px; }
.hidden { display: none !important; }
.check-row { grid-template-columns: auto 1fr; align-items: center; font-weight: 600; }
.check-row input { width: 18px; height: 18px; accent-color: var(--green); }
.field-note { margin: -7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.file-drop { border: 1px dashed #9eaaa1; border-radius: 14px; padding: 20px; background: #fafbf8; }
.file-drop small { color: var(--muted); font-weight: 400; line-height: 1.5; }
.primary-button { border: 0; border-radius: 12px; padding: 13px 18px; color: white; background: var(--green); font-weight: 800; box-shadow: 0 8px 18px rgba(28,107,74,.2); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.message { margin-top: 16px; border-radius: 12px; padding: 13px 15px; background: var(--green-soft); color: var(--green); line-height: 1.5; }
.message.error { background: #fff0eb; color: #9b3c26; }

.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.quiet-button { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: white; color: var(--ink); font-weight: 700; }
.quiet-button:disabled { color: #98a09a; background: #f1f2ef; cursor: not-allowed; }
.case-list { display: grid; gap: 10px; }
.case-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: #fbfcfa; }
.case-card strong, .case-card span { display: block; }
.case-card strong { margin-bottom: 6px; }
.case-card span { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.analysis-ai-row { margin: -5px 0 11px; }
.case-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.case-actions button { min-height: 38px; }
.case-message { margin: 10px 0 0; color: var(--green); font-size: .82rem; line-height: 1.5; }
.case-message.error { color: #9b3c26; }
.analysis-summary { margin-top: 10px; border-left: 3px solid #b8d9c7; padding-left: 10px; color: #344039; font-size: .82rem; line-height: 1.5; }
.manual-details { margin-top: 10px; }
.manual-details summary { cursor: pointer; color: var(--muted); font-size: .8rem; font-weight: 700; }
.manual-form { display: grid; gap: 8px; margin-top: 9px; }
.manual-form input, .manual-form select { padding: 9px 10px; font-size: .82rem; }
.empty-state { color: var(--muted); }
.radar-panel { margin-top: 22px; }
.radar-panel > p { color: var(--muted); line-height: 1.6; }
.radar-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 15px; }
.radar-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: #fbfcfa; }
.radar-item strong { display: block; margin-bottom: 5px; }
.radar-item span { color: var(--muted); font-size: .78rem; }

.access-admin-panel { margin-top: 22px; }
.admin-intro { color: var(--muted); line-height: 1.6; }
.invitation-form { grid-template-columns: minmax(240px, 1fr) auto; align-items: end; margin: 20px 0; }
.invitation-form .primary-button { min-height: 45px; }
.one-time-invitation { margin: 18px 0; border: 1px solid #e7c478; border-radius: 14px; background: var(--amber-soft); padding: 16px; }
.one-time-invitation strong { color: var(--amber); }
.one-time-invitation p { margin: 6px 0 13px; color: #70501f; font-size: .84rem; line-height: 1.5; }
.secret-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto auto; gap: 8px; }
.secret-row input { font-family: Consolas, "SFMono-Regular", monospace; letter-spacing: .03em; }
.invitation-list { display: grid; gap: 10px; margin-top: 20px; }
.invitation-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: #fbfcfa; }
.invitation-card strong, .invitation-card span { display: block; }
.invitation-card span { margin-top: 5px; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.invitation-status { flex: 0 0 auto; text-align: right; }
.invitation-status .quiet-button { margin-top: 8px; }
.status-active { color: var(--green); font-weight: 800; }
.status-revoked { color: #9b3c26; font-weight: 800; }

@media (max-width: 820px) {
  .hero, .isolation-card { align-items: flex-start; flex-direction: column; }
  .hero-status { justify-content: flex-start; }
  .status-grid { min-width: 0; width: 100%; }
  .workspace-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); padding-top: 28px; }
  .status-grid, .two-column { grid-template-columns: 1fr; }
  .mode-tabs { display: grid; }
  .panel, .isolation-card { padding: 20px; border-radius: 16px; }
  .invitation-form, .secret-row { grid-template-columns: 1fr; }
  .invitation-card { align-items: flex-start; flex-direction: column; }
  .invitation-status { text-align: left; }
}
