:root{--navy:#17324d;--navy2:#234b70;--ink:#223246;--muted:#718096;--line:#e3e9ef;--paper:#f5f7fa;--blue:#557fa7;--orange:#b87b45;--green:#56876f;--purple:#77669b;--shadow:0 12px 36px rgba(24,45,69,.08)}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif}button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}.eyebrow{margin:0;color:#8b98a7;font-size:10px;font-weight:700;letter-spacing:2px}h1,h2,h3,p{margin:0}h1,h2,h3{font-family:Georgia,"Songti SC",serif}.login-view{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 25% 10%,#315a80,var(--navy) 48%,#10253a)}.login-card{width:min(390px,100%);padding:44px 40px 34px;text-align:center;color:#fff;background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.22);border-radius:18px;box-shadow:0 28px 70px rgba(0,0,0,.22)}.seal,.mini-seal{display:grid;place-items:center;border:1px solid currentColor;border-radius:50%;font-family:Georgia,serif}.seal{width:48px;height:48px;margin:0 auto 18px;font-size:22px}.login-card .eyebrow{color:#c7d5e2}.login-card h1{margin-top:8px;font-size:32px;letter-spacing:3px}.muted-light{margin-top:10px;color:#c5d2df}.login-card form{margin-top:30px;text-align:left}.login-card label{color:#e4ebf3}.login-card input{color:#fff;background:rgba(0,0,0,.14);border-color:rgba(255,255,255,.3)}.login-card input::placeholder{color:#acbdce}.login-card small{display:block;margin-top:23px;color:#afc0d1}.error{height:18px;margin-top:6px;color:#ffc1bd;font-size:12px}.app-header{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;height:70px;padding:0 38px;background:#fff;border-bottom:1px solid var(--line)}.brand-button{display:flex;align-items:center;gap:10px;padding:0;border:0;color:var(--navy);background:transparent;text-align:left}.brand-button strong,.brand-button small{display:block}.brand-button strong{letter-spacing:1px}.brand-button small{margin-top:1px;color:#8c9aaa;font-size:9px;letter-spacing:1.2px}.mini-seal{width:31px;height:31px;font-size:15px}.header-actions{display:flex;gap:8px}.workspace{width:min(1180px,calc(100% - 36px));margin:0 auto;padding:42px 0 60px}.dashboard-hero,.department-hero{display:flex;justify-content:space-between;align-items:center;padding:30px 34px;color:#fff;background:linear-gradient(120deg,var(--navy),#2b567d);border-radius:14px;box-shadow:0 15px 35px rgba(23,50,77,.17)}.dashboard-hero .eyebrow,.department-hero .eyebrow{color:#b9ccdd}.dashboard-hero h2,.department-hero h2{margin-top:7px;font-size:28px;letter-spacing:1px}.dashboard-hero p:not(.eyebrow),.department-hero p:not(.eyebrow){margin-top:7px;color:#d4e0eb}.button{padding:9px 15px;border:1px solid transparent;border-radius:7px;font-weight:600;transition:.18s}.button.primary{color:#fff;background:var(--navy2);box-shadow:0 5px 14px rgba(11,32,52,.15)}.dashboard-hero .button.primary,.department-hero .button.primary{color:var(--navy);background:#fff}.button:hover{transform:translateY(-1px)}.button.ghost{color:#667587;background:transparent}.button.ghost:hover{background:#f0f3f6}.button.secondary{color:var(--navy);background:#fff;border-color:#d6dfe8}.button.large{padding:12px 18px}.button.full{width:100%}.department-section{margin-top:31px}.section-title,.panel-heading{display:flex;justify-content:space-between;align-items:flex-end}.section-title h3,.panel-heading h3{margin-top:5px;font-size:20px}.section-title>span{color:var(--muted);font-size:12px}.department-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-top:15px}.department-card{min-height:206px;display:flex;flex-direction:column;padding:23px;border:1px solid var(--line);border-top:4px solid var(--blue);border-radius:11px;color:var(--ink);background:#fff;box-shadow:var(--shadow);text-align:left;transition:.2s}.department-card:hover{transform:translateY(-4px);box-shadow:0 17px 42px rgba(24,45,69,.14)}.department-card.action{border-top-color:var(--orange)}.department-card.finance{border-top-color:var(--green)}.department-card.intelligence{border-top-color:var(--purple)}.department-icon{width:39px;height:39px;display:grid;place-items:center;border-radius:9px;color:var(--blue);background:#edf3f8;font-size:20px}.action .department-icon{color:var(--orange);background:#faf0e6}.finance .department-icon{color:var(--green);background:#eaf4ef}.intelligence .department-icon{color:var(--purple);background:#f1edf7}.department-copy{margin-top:19px}.department-copy strong,.department-copy small{display:block}.department-copy strong{font-family:Georgia,"Songti SC",serif;font-size:20px}.department-copy small{margin-top:7px;color:var(--muted);line-height:1.6}.department-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:auto;padding-top:22px}.department-bottom em{color:#8996a5;font-size:11px;font-style:normal}.department-bottom b{color:var(--navy);font-size:12px}.panel{background:#fff;border:1px solid var(--line);border-radius:11px;box-shadow:var(--shadow)}.recent-panel{margin-top:22px}.panel-heading{padding:20px 23px 15px;border-bottom:1px solid var(--line)}.panel-heading input{width:230px}.record-list{padding:0 23px}.record-row{display:flex;align-items:center;gap:13px;padding:16px 2px;border-bottom:1px solid #edf0f3}.record-row:last-child{border:0}.department-badge{flex:none;padding:5px 9px;border-radius:5px;color:#405b78;background:#edf3f8;font-size:11px}.record-main{min-width:0;flex:1}.record-title{display:block;overflow:hidden;font-weight:650;text-overflow:ellipsis;white-space:nowrap}.record-meta{display:flex;gap:10px;margin-top:5px;color:#8793a1;font-size:11px}.record-actions{display:flex;gap:2px}.record-actions button{padding:5px 7px;border:0;color:#788696;background:transparent;font-size:12px}.record-actions button:hover{color:var(--navy)}.empty{padding:55px 15px;text-align:center;color:var(--muted)}.empty strong{display:block;color:var(--ink)}.empty p{margin-top:6px;font-size:12px}.back-button{margin:0 0 17px;padding:0;border:0;color:#667587;background:transparent}.back-button:hover{color:var(--navy)}.department-heading{display:flex;align-items:center;gap:16px}.large-icon{width:52px;height:52px;color:var(--navy);background:#fff;font-size:25px}.department-panel{margin-top:22px}.filters{display:flex;gap:8px}.filters select{width:125px}.filters input{width:230px}.modal{position:fixed;inset:0;z-index:20;display:grid;place-items:center;padding:20px;background:rgba(14,31,48,.58)}.modal-card{width:min(530px,100%);max-height:calc(100vh - 36px);overflow:auto;padding:28px;background:#fff;border-radius:13px;box-shadow:0 28px 80px rgba(0,0,0,.24)}.modal-card.small{width:min(420px,100%)}.modal-heading{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:22px}.modal-heading h3{margin-top:5px;font-size:22px}.close{width:30px;height:30px;border:0;border-radius:50%;color:#778596;background:#f0f3f6;font-size:21px;line-height:1}label{display:block;margin:14px 0 7px;color:#526174;font-size:12px;font-weight:650}label span{color:#c35f50}input,select,textarea{width:100%;padding:10px 11px;border:1px solid #d7e0e8;border-radius:6px;color:var(--ink);background:#fff;outline:0}input:focus,select:focus,textarea:focus{border-color:#7294b4;box-shadow:0 0 0 3px rgba(85,127,167,.12)}textarea{resize:vertical}.two-columns{display:grid;grid-template-columns:1.35fr 1fr;gap:12px}.form-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}.setting-block{padding:18px 0;border-top:1px solid var(--line)}.setting-block p{margin:5px 0 12px;color:var(--muted);font-size:12px}.setting-block form{display:flex;gap:8px;margin-top:12px}.success{margin-top:8px!important;color:var(--green)!important}.toast{position:fixed;right:24px;bottom:24px;z-index:30;padding:11px 15px;border-radius:7px;color:#fff;background:var(--navy);box-shadow:0 8px 24px rgba(0,0,0,.18);font-size:12px;opacity:0;transform:translateY(8px);pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:none}@media(max-width:900px){.department-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:620px){.app-header{height:62px;padding:0 14px}.header-actions .ghost{display:none}.header-actions .primary{padding:8px 10px;font-size:12px}.workspace{width:calc(100% - 26px);padding:24px 0 45px}.dashboard-hero,.department-hero{align-items:flex-start;padding:24px 20px}.dashboard-hero h2,.department-hero h2{font-size:23px}.dashboard-hero p:not(.eyebrow),.department-hero p:not(.eyebrow){font-size:12px}.dashboard-hero>.button{display:none}.department-grid{grid-template-columns:1fr 1fr;gap:10px}.department-card{min-height:175px;padding:17px}.department-copy{margin-top:13px}.department-copy strong{font-size:17px}.department-copy small{font-size:11px}.department-bottom{padding-top:13px}.department-bottom b{display:none}.panel-heading{display:block;padding:18px 16px 13px}.panel-heading input{width:100%;margin-top:12px}.record-list{padding:0 16px}.filters{margin-top:12px}.filters select{width:115px}.filters input{width:100%;margin-top:0}.department-heading{gap:11px}.large-icon{width:42px;height:42px}.department-hero>.button{padding:9px 10px;font-size:11px}.modal-card{padding:23px 18px}.two-columns{display:block}.login-card{padding:38px 27px 30px}}
:root{--touch:44px}

/* Touch-first adjustments for phones. Keep the desktop layout unchanged. */
@media (max-width: 620px) {
  body { min-width: 0; -webkit-text-size-adjust: 100%; }
  .app-header { padding-top: env(safe-area-inset-top); height: calc(62px + env(safe-area-inset-top)); }
  .brand-button { min-width: 0; }
  .brand-button strong { font-size: 13px; }
  .brand-button small { font-size: 8px; }
  .header-actions { flex: none; gap: 3px; }
  .header-actions .primary { min-height: var(--touch); }
  .header-actions .ghost { display: inline-grid; place-items: center; width: 34px; height: var(--touch); padding: 0; font-size: 0; }
  .header-actions #settingsBtn::before { content: "⚙"; font-size: 17px; }
  .header-actions #logoutBtn::before { content: "↪"; font-size: 19px; }
  .workspace { padding-bottom: calc(45px + env(safe-area-inset-bottom)); }
  .dashboard-hero, .department-hero { gap: 18px; }
  .dashboard-hero > .button { display: inline-flex; align-self: stretch; align-items: center; justify-content: center; flex: 0 0 auto; }
  .department-hero > .button { align-self: center; flex: 0 0 auto; }
  .section-title { align-items: flex-start; gap: 10px; }
  .section-title > span { text-align: right; }
  .filters { display: grid; grid-template-columns: minmax(108px, 0.8fr) minmax(0, 1.2fr); }
  .filters select, .filters input { width: 100%; min-width: 0; }
  input, select, textarea { font-size: 16px; }
  .record-row { align-items: flex-start; flex-wrap: wrap; gap: 8px 10px; padding: 15px 2px; }
  .record-main { flex-basis: calc(100% - 105px); }
  .record-actions { width: 100%; justify-content: flex-end; border-top: 1px solid #f0f2f4; padding-top: 6px; }
  .record-actions button { min-width: 54px; min-height: 34px; }
  .toast { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); left: 14px; text-align: center; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-height: calc(100dvh - 12px); border-radius: 16px 16px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  .modal-card.small { width: 100%; }
  .form-actions { position: sticky; bottom: 0; padding-top: 12px; background: #fff; }
  .form-actions .button { min-height: var(--touch); flex: 1; }
}

@media (max-width: 380px) {
  .app-header { padding-left: 10px; padding-right: 10px; }
  .header-actions .primary { padding-left: 8px; padding-right: 8px; }
  .header-actions .ghost { width: 30px; }
  .department-grid { grid-template-columns: 1fr; }
  .department-card { min-height: 145px; }
  .dashboard-hero, .department-hero { padding: 20px 16px; }
  .dashboard-hero, .department-hero { display: block; }
  .dashboard-hero > .button, .department-hero > .button { width: 100%; margin-top: 16px; min-height: var(--touch); }
  .record-main { flex-basis: calc(100% - 92px); }
}

/* Headquarters hierarchy */
.organization-grid,
.subdepartment-grid { grid-template-columns: repeat(3, 1fr); }
.department-card.political { border-top-color: var(--orange); }
.department-card.logistics { border-top-color: var(--green); }
.political .department-icon { color: var(--orange); background: #faf0e6; }
.logistics .department-icon { color: var(--green); background: #eaf4ef; }

@media (max-width: 900px) {
  .organization-grid,
  .subdepartment-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .login-card h1 { font-size: 25px; letter-spacing: 1px; }
  .brand-button strong { max-width: 138px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .organization-grid,
  .subdepartment-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .organization-grid,
  .subdepartment-grid { grid-template-columns: 1fr; }
}

.backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.backup-message { color: #526174; font-size: 13px; overflow-wrap: anywhere; }
.cloud-backup-list { display: grid; gap: 7px; margin: 12px 0 0 42px; max-height: 220px; overflow: auto; }
.cloud-backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.04); }
.cloud-backup-row strong, .cloud-backup-row small { display: block; }
.cloud-backup-row strong { font-size: 12px; }
.cloud-backup-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.cloud-backup-download { flex: 0 0 auto; padding: 6px 8px; }

/* Deep-space glass theme: visual treatment only, layout stays unchanged. */
:root {
  --navy: #07111f;
  --navy2: #0a84ff;
  --ink: #eef6ff;
  --muted: #93a5ba;
  --line: rgba(255, 255, 255, .12);
  --paper: #07111f;
  --blue: #5ac8fa;
  --orange: #ff9f6e;
  --green: #63e6a8;
  --purple: #b69cff;
  --shadow: 0 20px 55px rgba(0, 0, 0, .28);
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(10, 132, 255, .23), transparent 31%),
    radial-gradient(circle at 88% 18%, rgba(90, 200, 250, .13), transparent 28%),
    radial-gradient(circle at 48% 100%, rgba(99, 230, 168, .08), transparent 34%),
    linear-gradient(145deg, #050a12 0%, #071525 50%, #0b1725 100%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1, h2, h3,
.department-copy strong {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: -.02em;
}

.app-header {
  color: var(--ink);
  background: rgba(7, 17, 31, .72);
  border-bottom-color: rgba(255, 255, 255, .1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .18);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.brand-button,
.brand-button strong { color: #f4f8ff; }
.brand-button small { color: rgba(224, 237, 252, .5); }
.mini-seal { color: #8ed8ff; box-shadow: inset 0 0 18px rgba(90, 200, 250, .12); }

.dashboard-hero,
.department-hero {
  background:
    linear-gradient(120deg, rgba(10, 132, 255, .2), rgba(90, 200, 250, .05)),
    rgba(255, 255, 255, .065);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.dashboard-hero p:not(.eyebrow),
.department-hero p:not(.eyebrow) { color: rgba(235, 245, 255, .7); }
.eyebrow { color: rgba(178, 202, 226, .65); }

.panel,
.department-card,
.modal-card {
  color: var(--ink);
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .13);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}

.department-card:hover {
  border-color: rgba(142, 216, 255, .34);
  background: rgba(255, 255, 255, .095);
  box-shadow: 0 25px 70px rgba(0, 0, 0, .36), 0 0 0 1px rgba(90, 200, 250, .06);
}

.department-icon,
.political .department-icon,
.logistics .department-icon {
  color: #8ed8ff;
  background: rgba(90, 200, 250, .1);
  border: 1px solid rgba(90, 200, 250, .14);
}
.political .department-icon { color: #ffc199; background: rgba(255, 159, 110, .1); }
.logistics .department-icon { color: #8ff0c2; background: rgba(99, 230, 168, .1); }
.department-copy small,
.department-bottom em,
.section-title > span,
.sync-status,
.backup-message { color: var(--muted); }
.department-bottom b { color: #8ed8ff; }

.panel-heading,
.record-row,
.setting-block { border-color: rgba(255, 255, 255, .09); }
.record-meta { color: rgba(213, 229, 246, .5); }
.department-badge {
  color: #bce8ff;
  background: rgba(90, 200, 250, .1);
  border: 1px solid rgba(90, 200, 250, .13);
}
.empty strong { color: var(--ink); }

input,
select,
textarea {
  color: #f2f7ff;
  background: rgba(4, 12, 22, .48);
  border-color: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}
input::placeholder,
textarea::placeholder { color: rgba(210, 227, 243, .38); }
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(90, 200, 250, .7);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .04);
}
select option { color: #eef6ff; background: #101b29; }
label { color: rgba(225, 237, 250, .7); }

.button {
  border-radius: 12px;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.button.primary,
.dashboard-hero .button.primary,
.department-hero .button.primary {
  color: #fff;
  background: linear-gradient(145deg, #1894ff, #006ee6);
  border-color: rgba(255, 255, 255, .22);
  box-shadow: 0 10px 28px rgba(0, 113, 227, .36), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.button.secondary,
.button.ghost {
  color: #ddecff;
  background: rgba(255, 255, 255, .075);
  border-color: rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.button:hover { transform: translateY(-1px) scale(1.012); }
.button:active { transform: translateY(0) scale(.985); }
.button.primary:hover { box-shadow: 0 14px 34px rgba(0, 113, 227, .48), inset 0 1px 0 rgba(255, 255, 255, .3); }
.button.secondary:hover,
.button.ghost:hover { color: #fff; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); }

.record-actions button,
.back-button {
  color: rgba(215, 232, 249, .62);
  border-radius: 8px;
}
.record-actions button:hover {
  color: #bce8ff;
  background: rgba(90, 200, 250, .1);
}
.back-button:hover { color: #8ed8ff; }

.modal { background: rgba(0, 5, 12, .68); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.close { color: #dcecff; background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .1); }
.toast { background: rgba(15, 35, 54, .88); border: 1px solid rgba(255, 255, 255, .13); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }

.login-view {
  background:
    radial-gradient(circle at 20% 10%, rgba(10, 132, 255, .34), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(90, 200, 250, .12), transparent 35%),
    linear-gradient(145deg, #03070d, #08182a 58%, #07111f);
}
.login-card {
  background: rgba(255, 255, 255, .075);
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(28px) saturate(145%);
  -webkit-backdrop-filter: blur(28px) saturate(145%);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .panel,
  .department-card,
  .modal-card,
  .login-card { background: #101c2b; }
}

/* Titanium glass refinement: quieter color, sharper material and light hierarchy. */
:root {
  --navy: #06080d;
  --navy2: #087ff5;
  --ink: #f5f7fb;
  --muted: #8c98a8;
  --line: rgba(255, 255, 255, .09);
  --paper: #06080d;
  --shadow: 0 28px 70px rgba(0, 0, 0, .38), 0 2px 10px rgba(0, 0, 0, .22);
}

body {
  background:
    radial-gradient(ellipse 70% 48% at 8% -6%, rgba(36, 119, 196, .22), transparent 60%),
    radial-gradient(ellipse 42% 34% at 91% 8%, rgba(75, 117, 164, .11), transparent 68%),
    radial-gradient(ellipse 55% 42% at 50% 108%, rgba(23, 86, 122, .08), transparent 72%),
    linear-gradient(155deg, #030509 0%, #080c13 48%, #05070b 100%);
}

.login-view {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse 50% 46% at 18% 2%, rgba(26, 113, 196, .26), transparent 70%),
    radial-gradient(ellipse 42% 38% at 82% 94%, rgba(36, 91, 128, .1), transparent 74%),
    linear-gradient(155deg, #030509 0%, #080d15 52%, #04070b 100%);
}

.login-view::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(72vw, 820px);
  aspect-ratio: 1;
  top: -52%;
  left: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(49, 154, 255, .13), rgba(16, 80, 143, .035) 46%, transparent 72%);
  filter: blur(28px);
  pointer-events: none;
}

.login-view::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.login-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025) 48%, rgba(255, 255, 255, .045)),
    rgba(9, 15, 24, .62);
  border-color: rgba(255, 255, 255, .13);
  border-radius: 24px;
  box-shadow:
    0 42px 110px rgba(0, 0, 0, .58),
    0 10px 28px rgba(0, 0, 0, .28),
    inset 0 1px 0 rgba(255, 255, 255, .16),
    inset 0 -1px 0 rgba(255, 255, 255, .035);
  backdrop-filter: blur(40px) saturate(125%);
  -webkit-backdrop-filter: blur(40px) saturate(125%);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent 8%, rgba(210, 235, 255, .7) 50%, transparent 92%);
  opacity: .55;
  pointer-events: none;
}

.seal,
.mini-seal {
  color: #dceeff;
  border-color: rgba(220, 238, 255, .48);
  background: linear-gradient(145deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .015));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 8px 26px rgba(0, 0, 0, .2);
}

.app-header {
  background: rgba(5, 8, 13, .72);
  border-bottom-color: rgba(255, 255, 255, .075);
  box-shadow: 0 12px 38px rgba(0, 0, 0, .26), inset 0 -1px 0 rgba(255, 255, 255, .025);
  backdrop-filter: blur(34px) saturate(120%);
  -webkit-backdrop-filter: blur(34px) saturate(120%);
}

.dashboard-hero,
.department-hero,
.panel,
.department-card,
.modal-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .018) 58%, rgba(255, 255, 255, .035)),
    rgba(8, 13, 21, .62);
  border-color: rgba(255, 255, 255, .095);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .11);
  backdrop-filter: blur(32px) saturate(120%);
  -webkit-backdrop-filter: blur(32px) saturate(120%);
}

.department-card:hover {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .025)),
    rgba(9, 15, 24, .72);
  border-color: rgba(177, 220, 255, .2);
  box-shadow: 0 34px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .15);
}

input,
select,
textarea {
  background: rgba(0, 0, 0, .22);
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .24), 0 1px 0 rgba(255, 255, 255, .025);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(87, 169, 247, .7);
  box-shadow: 0 0 0 4px rgba(26, 129, 230, .13), inset 0 1px 2px rgba(0, 0, 0, .2);
}

.button {
  position: relative;
  overflow: hidden;
  border-radius: 11px;
  letter-spacing: .01em;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.button.primary,
.dashboard-hero .button.primary,
.department-hero .button.primary {
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 45%),
    linear-gradient(145deg, #1595f9 0%, #087eea 48%, #0067d4 100%);
  border-color: rgba(170, 220, 255, .35);
  box-shadow:
    0 12px 30px rgba(0, 103, 212, .28),
    0 2px 8px rgba(0, 0, 0, .24),
    inset 0 1px 0 rgba(255, 255, 255, .34),
    inset 0 -1px 0 rgba(0, 39, 95, .28);
  text-shadow: 0 1px 1px rgba(0, 35, 80, .25);
}

.button.primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 22%, rgba(255, 255, 255, .16) 48%, transparent 72%);
  transform: translateX(-115%);
  transition: transform .5s cubic-bezier(.22, .8, .3, 1);
  pointer-events: none;
}

.button.primary:hover::before { transform: translateX(115%); }
.button.primary:hover {
  box-shadow:
    0 16px 36px rgba(0, 111, 224, .36),
    0 3px 10px rgba(0, 0, 0, .25),
    inset 0 1px 0 rgba(255, 255, 255, .4),
    inset 0 -1px 0 rgba(0, 39, 95, .24);
}

.button.secondary,
.button.ghost {
  color: rgba(239, 246, 255, .88);
  background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .035));
  border-color: rgba(255, 255, 255, .105);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 5px 14px rgba(0, 0, 0, .12);
}

.button.secondary:hover,
.button.ghost:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, .115), rgba(255, 255, 255, .055));
  border-color: rgba(255, 255, 255, .17);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 8px 20px rgba(0, 0, 0, .18);
}

.modal {
  background: rgba(0, 2, 6, .74);
  backdrop-filter: blur(18px) saturate(90%);
  -webkit-backdrop-filter: blur(18px) saturate(90%);
}

@media (max-width: 620px) {
  .form-actions { background: rgba(8, 13, 21, .94); }
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .button.primary::before { transition: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header,
  .panel,
  .department-card,
  .modal-card,
  .login-card { background: #0d131d; }
}

/* Command-deck layout: wide horizontal navigation, never vertical Chinese text. */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  align-items: start;
}

.app-header {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 5;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 28px 15px 20px;
  border-right: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 0;
  background: rgba(5, 8, 13, .78);
  box-shadow: 16px 0 40px rgba(0, 0, 0, .18);
  backdrop-filter: blur(34px) saturate(120%);
  -webkit-backdrop-filter: blur(34px) saturate(120%);
}

.brand-button {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  padding: 0 10px;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.brand-button > span:last-child { min-width: 0; }
.brand-button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav {
  display: grid;
  gap: 5px;
  margin-top: 34px;
  padding: 0 2px;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(215, 232, 249, .62);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.app-nav-link .nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  color: #8ed8ff;
  font-size: 14px;
  line-height: 1;
}

.app-nav-link:hover,
.app-nav-link.is-active {
  color: #f7fbff;
  background: linear-gradient(100deg, rgba(90, 200, 250, .14), rgba(255, 255, 255, .045));
  border-color: rgba(142, 216, 255, .17);
}

.app-nav-link:hover { transform: translateX(2px); }

.header-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding: 15px 2px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.header-actions #headerQuickAdd { grid-column: 1 / -1; width: 100%; }
.header-actions .button { min-height: 38px; padding: 8px 10px; }

.workspace {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 42px clamp(24px, 5vw, 66px) 60px;
}

.sync-status { max-width: 1180px; margin-right: auto; }
.dashboard-hero,
.department-hero { max-width: 1180px; margin-left: auto; margin-right: auto; }
.department-section,
.recent-panel,
.department-panel { max-width: 1180px; margin-left: auto; margin-right: auto; }

/* Keep every title and label horizontal even in constrained containers. */
.app-header *,
.workspace *,
.modal * {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 208px minmax(0, 1fr); }
  .workspace { padding-left: 28px; padding-right: 28px; }
  .app-nav-link { font-size: 12px; }
}

@media (max-width: 620px) {
  .app { display: block; min-height: 100vh; }
  .app-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    min-height: calc(116px + env(safe-area-inset-top));
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
  }

  .brand-button { width: auto; flex: 1 1 auto; padding: 0; }
  .brand-button strong { max-width: 180px; font-size: 13px; }
  .app-nav {
    order: 3;
    display: flex;
    width: 100%;
    gap: 5px;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-nav-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }
  .app-nav-link .nav-icon { flex-basis: 18px; width: 18px; height: 18px; font-size: 12px; }
  .header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .header-actions #headerQuickAdd { width: auto; }
  .header-actions .button { min-height: 38px; }
  .header-actions .ghost { display: none; }
  .workspace {
    width: 100%;
    padding: 24px 13px calc(45px + env(safe-area-inset-bottom));
  }
  .sync-status { margin-bottom: 12px; }
}

@media (max-width: 380px) {
  .brand-button strong { max-width: 135px; }
  .app-nav-link { padding-left: 8px; padding-right: 8px; }
  .app-nav-link .nav-icon { display: none; }
}

/* Mobile pass: preserve comfortable targets and prevent horizontal collisions. */
@media (max-width: 620px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app-header { isolation: isolate; }
  .brand-button { min-width: 0; }
  .brand-button > span:last-child { overflow: hidden; }
  .brand-button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-actions { max-width: 42%; }
  .header-actions #headerQuickAdd { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-nav-link { min-width: max-content; }
  .workspace { overflow-x: clip; }
  .dashboard-hero,
  .department-hero { align-items: flex-start; gap: 14px; }
  .dashboard-hero > div,
  .department-hero > div { min-width: 0; }
  .dashboard-hero h2,
  .department-hero h2 { overflow-wrap: anywhere; }
  .department-card { min-width: 0; }
  .department-copy { min-width: 0; }
  .department-copy strong,
  .department-copy small { overflow-wrap: anywhere; }
  .section-title { align-items: flex-start; gap: 10px; }
  .section-title > span { max-width: 46%; line-height: 1.45; }
  .record-row { min-width: 0; }
  .record-actions { flex-wrap: wrap; }
  .record-actions button { flex: 0 0 auto; }
  .panel-heading,
  .modal-heading { min-width: 0; }
  .panel-heading h3,
  .modal-heading h3 { overflow-wrap: anywhere; }
  .filters { min-width: 0; }
  .filters select,
  .filters input { min-width: 0; }
  .two-columns { min-width: 0; }
}

@media (max-width: 380px) {
  .app-header { padding-left: 10px; padding-right: 10px; }
  .brand-button { gap: 7px; }
  .brand-button strong { max-width: 130px; font-size: 12px; }
  .brand-button small { font-size: 7px; letter-spacing: .7px; }
  .mini-seal { width: 28px; height: 28px; font-size: 13px; }
  .header-actions { max-width: 40%; }
  .header-actions #headerQuickAdd { padding-left: 8px; padding-right: 8px; font-size: 11px; }
  .app-nav { gap: 4px; }
  .app-nav-link { min-height: 34px; padding-left: 9px; padding-right: 9px; font-size: 11px; }
  .workspace { padding-left: 10px; padding-right: 10px; }
  .dashboard-hero,
  .department-hero { padding: 19px 15px; }
  .dashboard-hero h2,
  .department-hero h2 { font-size: 21px; }
  .dashboard-hero p:not(.eyebrow),
  .department-hero p:not(.eyebrow) { line-height: 1.55; }
  .section-title > span { max-width: 52%; font-size: 11px; }
  .record-actions { justify-content: stretch; }
  .record-actions button { flex: 1 1 auto; min-width: 0; }
}

/* Stable component refinement: Web Awesome-inspired tokens + local Tabler icons. */
:root {
  --ui-radius-sm: 10px;
  --ui-radius-md: 14px;
  --ui-radius-lg: 18px;
  --ui-border: rgba(255, 255, 255, .095);
  --ui-border-strong: rgba(142, 216, 255, .24);
  --ui-surface: rgba(13, 18, 27, .72);
  --ui-surface-raised: rgba(19, 25, 36, .88);
  --ui-text: #f3f7fb;
  --ui-text-muted: rgba(211, 225, 240, .58);
  --ui-brand: #72d0ff;
  --ui-success: #72d7ad;
  --ui-warning: #e9bd74;
  --ui-danger: #ff8d96;
  --ui-transition: 170ms cubic-bezier(.2, .8, .2, 1);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes ui-spin { to { transform: rotate(360deg); } }
.icon.spin { animation: ui-spin .8s linear infinite; }

h1, h2, h3,
.department-copy strong {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 650;
}

.button,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.button .icon { width: 17px; height: 17px; }
.button.large .icon { width: 18px; height: 18px; }
.button.is-loading { pointer-events: none; }

.back-button {
  min-height: 34px;
  gap: 6px;
  padding: 0 8px;
  border-radius: 9px;
  transition: color var(--ui-transition), background var(--ui-transition);
}
.back-button .icon { width: 17px; height: 17px; }
.back-button:hover { background: rgba(255, 255, 255, .055); }

.app-nav-link { position: relative; }
.app-nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 2px;
  border-radius: 999px;
  background: var(--ui-brand);
  box-shadow: 0 0 14px rgba(114, 208, 255, .65);
  opacity: 0;
  transform: scaleY(.5);
  transition: opacity var(--ui-transition), transform var(--ui-transition);
}
.app-nav-link.is-active::before { opacity: 1; transform: scaleY(1); }
.app-nav-link .nav-icon {
  flex-basis: 30px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 9px;
  color: rgba(203, 226, 245, .7);
  background: rgba(255, 255, 255, .035);
  transition: color var(--ui-transition), border-color var(--ui-transition), background var(--ui-transition);
}
.app-nav-link .nav-icon .icon { width: 17px; height: 17px; }
.app-nav-link:hover .nav-icon,
.app-nav-link.is-active .nav-icon {
  color: var(--ui-brand);
  border-color: rgba(114, 208, 255, .2);
  background: rgba(114, 208, 255, .09);
}

.header-actions .ghost { gap: 5px; }
.header-actions .ghost .icon { width: 15px; height: 15px; }

.department-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--ui-radius-md);
  transition: transform var(--ui-transition), border-color var(--ui-transition), box-shadow var(--ui-transition), background var(--ui-transition);
}
.department-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(380px circle at var(--card-x, 15%) -15%, rgba(114, 208, 255, .10), transparent 48%);
  opacity: .65;
  pointer-events: none;
}
.department-card:hover {
  transform: translateY(-2px);
  border-color: rgba(142, 216, 255, .18);
  box-shadow: 0 20px 42px rgba(0, 0, 0, .23), inset 0 1px rgba(255, 255, 255, .07);
}
.department-icon {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .025));
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 10px 25px rgba(0, 0, 0, .16);
}
.department-icon .icon { width: 21px; height: 21px; }
.large-icon .icon { width: 25px; height: 25px; }
.department-bottom em,
.child-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 999px;
  color: rgba(218, 231, 244, .62);
  background: rgba(255, 255, 255, .035);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}
.department-bottom b { display: inline-flex; align-items: center; gap: 2px; }
.department-bottom b .icon { width: 15px; height: 15px; transition: transform var(--ui-transition); }
.department-card:hover .department-bottom b .icon { transform: translateX(2px); }

.record-list { position: relative; }
.record-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  margin-left: calc(var(--tree-depth, 0) * 20px);
  width: calc(100% - var(--tree-depth, 0) * 20px);
  padding: 13px 4px;
  border-bottom-color: rgba(255, 255, 255, .065);
}
.record-row.is-tree::before {
  content: "";
  position: absolute;
  left: -11px;
  top: -1px;
  bottom: -1px;
  width: 1px;
  background: linear-gradient(rgba(114, 208, 255, .06), rgba(114, 208, 255, .22), rgba(114, 208, 255, .06));
}
.record-leading {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  color: rgba(177, 210, 237, .7);
  background: rgba(255, 255, 255, .035);
}
.record-row.has-children .record-leading {
  color: var(--ui-brand);
  border-color: rgba(114, 208, 255, .17);
  background: rgba(114, 208, 255, .07);
}
.record-leading .icon { width: 18px; height: 18px; }
.record-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-title { min-width: 0; color: var(--ui-text); }
.record-meta { align-items: center; flex-wrap: wrap; gap: 6px 9px; }
.record-meta > span { white-space: nowrap; }
.record-meta .tag-copy { overflow: hidden; max-width: 220px; text-overflow: ellipsis; }
.department-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  line-height: 1;
}
.department-badge { color: rgba(179, 217, 244, .8); background: rgba(114, 208, 255, .065); }
.status-badge.neutral { color: rgba(214, 225, 237, .66); background: rgba(255, 255, 255, .035); }
.status-badge.progress { color: #9cdaff; border-color: rgba(114, 208, 255, .18); background: rgba(114, 208, 255, .075); }
.status-badge.success { color: #8ce4bd; border-color: rgba(114, 215, 173, .18); background: rgba(114, 215, 173, .07); }
.status-badge.muted { color: rgba(207, 218, 230, .46); background: rgba(255, 255, 255, .025); }

.record-actions { align-items: center; gap: 4px; }
.record-action {
  position: relative;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(206, 222, 237, .56);
  background: transparent;
  transition: color var(--ui-transition), background var(--ui-transition), border-color var(--ui-transition), transform var(--ui-transition);
}
.record-action .icon { width: 16px; height: 16px; }
.record-action:hover {
  color: var(--ui-text);
  border-color: rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .055);
  transform: translateY(-1px);
}
.record-action.danger:hover { color: var(--ui-danger); border-color: rgba(255, 141, 150, .16); background: rgba(255, 141, 150, .07); }
.record-action[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 7px;
  color: #eef6fd;
  background: rgba(8, 11, 17, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity var(--ui-transition), transform var(--ui-transition);
}
.record-action[data-tooltip]:hover::after,
.record-action[data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.record-more { display: none; position: relative; }

.empty { display: grid; justify-items: center; }
.empty > .icon {
  width: 34px;
  height: 34px;
  margin-bottom: 13px;
  color: rgba(142, 216, 255, .44);
  stroke-width: 1.6;
}

.setting-block {
  margin-top: 12px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 13px;
  background: rgba(255, 255, 255, .025);
}
.setting-block:first-of-type { margin-top: 0; }
.setting-heading { display: flex; align-items: center; gap: 10px; }
.setting-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(114, 208, 255, .14);
  border-radius: 9px;
  color: var(--ui-brand);
  background: rgba(114, 208, 255, .06);
}
.setting-icon .icon { width: 16px; height: 16px; }
.setting-block p { margin-left: 42px; }
.backup-actions { margin-left: 42px; }

.close {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .07);
  color: rgba(218, 230, 243, .62);
  background: rgba(255, 255, 255, .04);
  transition: color var(--ui-transition), background var(--ui-transition), transform var(--ui-transition);
}
.close .icon { width: 16px; height: 16px; }
.close:hover { color: var(--ui-text); background: rgba(255, 255, 255, .08); transform: rotate(4deg); }

.toast {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(114, 215, 173, .18);
  border-radius: 12px;
  color: #edf9f4;
  background: rgba(10, 24, 21, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.toast[data-tone="danger"] { border-color: rgba(255, 141, 150, .2); color: #fff1f2; background: rgba(30, 12, 16, .94); }
.toast-icon { color: var(--ui-success); }
.toast[data-tone="danger"] .toast-icon { color: var(--ui-danger); }
.toast-icon .icon { width: 18px; height: 18px; }

.sync-status {
  width: max-content;
  max-width: min(100%, 1180px);
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 999px;
  color: rgba(204, 222, 239, .62);
  background: rgba(255, 255, 255, .028);
  font-size: 11px;
}
.sync-status-icon { color: var(--ui-warning); }
.sync-status[data-state="ok"] .sync-status-icon { color: var(--ui-success); }
.sync-status[data-state="error"] .sync-status-icon { color: var(--ui-danger); }
.sync-status-icon .icon { width: 15px; height: 15px; }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(114, 208, 255, .5);
  box-shadow: 0 0 0 3px rgba(114, 208, 255, .1), inset 0 1px rgba(255, 255, 255, .035);
}

@media (max-width: 620px) {
  .app-nav-link .nav-icon { flex-basis: 26px; width: 26px; height: 26px; border-radius: 8px; }
  .app-nav-link .nav-icon .icon { width: 15px; height: 15px; }
  .record-list { padding-left: 12px; padding-right: 12px; }
  .record-row {
    grid-template-columns: 34px minmax(0, 1fr) 36px;
    gap: 9px;
    width: calc(100% - var(--tree-depth, 0) * 12px);
    margin-left: calc(var(--tree-depth, 0) * 12px);
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .record-row.is-tree::before { left: -7px; }
  .record-leading { width: 32px; height: 32px; border-radius: 9px; }
  .record-leading .icon { width: 16px; height: 16px; }
  .record-title-line { align-items: flex-start; flex-direction: column; gap: 5px; }
  .child-count { min-height: 19px; padding: 2px 6px; font-size: 9px; }
  .record-meta { margin-top: 7px; gap: 5px 7px; }
  .record-meta .tag-copy { max-width: 150px; }
  .record-actions { display: none; }
  .record-more { display: block; justify-self: end; }
  .record-more summary {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: 9px;
    color: rgba(218, 231, 243, .62);
    background: rgba(255, 255, 255, .035);
    cursor: pointer;
    list-style: none;
  }
  .record-more summary::-webkit-details-marker { display: none; }
  .record-more summary .icon { width: 17px; height: 17px; }
  .record-more[open] { z-index: 25; }
  .record-more[open] summary { color: var(--ui-brand); border-color: rgba(114, 208, 255, .2); }
  .record-more-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 7px);
    z-index: 30;
    width: 158px;
    display: grid;
    gap: 3px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    background: rgba(10, 14, 21, .97);
    box-shadow: 0 18px 45px rgba(0, 0, 0, .38);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .record-more-menu .record-action {
    width: 100%;
    justify-content: flex-start;
    color: rgba(226, 237, 247, .72);
  }
  .record-more-menu .record-action::after { display: none; }
  .setting-block p,
  .backup-actions { margin-left: 0; }
  .backup-actions { margin-top: 14px; }
  .cloud-backup-list { margin-left: 0; }
  .toast { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal { place-items: end center; padding: 0; }
  .modal-card,
  .modal-card.small {
    width: 100%;
    max-height: calc(92vh - env(safe-area-inset-top));
    padding: 23px 18px calc(20px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }
}

@media (max-width: 380px) {
  .app-nav-link .nav-icon { display: grid; }
  .record-list { padding-left: 9px; padding-right: 9px; }
  .record-row { grid-template-columns: 30px minmax(0, 1fr) 34px; gap: 7px; }
  .record-leading { width: 29px; height: 29px; }
  .department-badge,
  .status-badge { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .icon.spin { animation-duration: 1.4s; }
  .app-nav-link::before,
  .app-nav-link .nav-icon,
  .record-action,
  .department-bottom b .icon { transition: none; }
}

/* Motion system: restrained spring transitions with accessible fallbacks. */
:root {
  --motion-spring: cubic-bezier(.22, 1, .36, 1);
  --motion-soft: cubic-bezier(.32, .72, 0, 1);
}

@keyframes workspace-enter {
  from { opacity: 0; transform: translateY(10px) scale(.995); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

@keyframes surface-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-card-enter {
  from { opacity: 0; transform: translateY(18px) scale(.975); }
  to { opacity: 1; transform: none; }
}

@keyframes modal-backdrop-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modal-card-exit {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(10px) scale(.985); }
}

@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-5px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.view-enter {
  animation: workspace-enter 420ms var(--motion-spring) both;
}

.view-enter .dashboard-hero,
.view-enter .department-hero,
.view-enter .section-title,
.view-enter .panel {
  animation: surface-enter 460ms var(--motion-spring) both;
}

.view-enter .section-title { animation-delay: 45ms; }
.view-enter .panel { animation-delay: 90ms; }
.view-enter .department-card {
  animation: surface-enter 480ms var(--motion-spring) both;
}
.view-enter .department-card:nth-child(1) { animation-delay: 70ms; }
.view-enter .department-card:nth-child(2) { animation-delay: 105ms; }
.view-enter .department-card:nth-child(3) { animation-delay: 140ms; }
.view-enter .department-card:nth-child(4) { animation-delay: 175ms; }
.view-enter .department-card:nth-child(5) { animation-delay: 210ms; }
.view-enter .record-row {
  animation: surface-enter 420ms var(--motion-spring) both;
}
.view-enter .record-row:nth-child(1) { animation-delay: 120ms; }
.view-enter .record-row:nth-child(2) { animation-delay: 150ms; }
.view-enter .record-row:nth-child(3) { animation-delay: 180ms; }
.view-enter .record-row:nth-child(4) { animation-delay: 210ms; }
.view-enter .record-row:nth-child(n+5) { animation-delay: 240ms; }

.modal:not(.hidden) { animation: modal-backdrop-enter 200ms ease-out both; }
.modal:not(.hidden) .modal-card { animation: modal-card-enter 360ms var(--motion-soft) both; }
.modal.is-closing { pointer-events: none; animation: modal-backdrop-exit 180ms ease-in both; }
.modal.is-closing .modal-card { animation: modal-card-exit 180ms ease-in both; }

.button:active,
.app-nav-link:active,
.record-action:active,
.record-more summary:active { transform: scale(.96); transition-duration: 60ms; }
.department-card:active { transform: translateY(0) scale(.988); transition-duration: 60ms; }
.brand-button:active { transform: scale(.985); }

.toast {
  transform: translateY(12px) scale(.985);
  transition: opacity 220ms ease, transform 420ms var(--motion-spring);
}
.toast.show { transform: none; }

@media (max-width: 620px) {
  @keyframes modal-card-enter {
    from { opacity: 0; transform: translateY(34px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes modal-card-exit {
    from { opacity: 1; transform: none; }
    to { opacity: 0; transform: translateY(24px); }
  }
  .record-more[open] .record-more-menu {
    transform-origin: top right;
    animation: menu-pop 220ms var(--motion-spring) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Theme picker: Web Awesome-style states with local Tabler icons. */
html[data-theme="titanium"] { color-scheme: dark; }
.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0 42px;
}
.theme-option {
  position: relative;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  color: var(--ui-text);
  background: rgba(255, 255, 255, .025);
  text-align: left;
  transition: transform var(--ui-transition), border-color var(--ui-transition), background var(--ui-transition), box-shadow var(--ui-transition);
}
.theme-option:hover { transform: translateY(-2px); border-color: rgba(114, 208, 255, .2); background: rgba(255, 255, 255, .045); }
.theme-option:focus-visible { outline: 3px solid rgba(114, 208, 255, .2); outline-offset: 2px; }
.theme-option.is-selected { border-color: rgba(114, 208, 255, .42); box-shadow: 0 0 0 3px rgba(114, 208, 255, .08); }
.theme-preview {
  height: 52px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding: 9px;
  border-radius: 8px;
  overflow: hidden;
}
.theme-preview i { display: block; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 2px 7px rgba(0, 0, 0, .16); }
.theme-preview-titanium { background: linear-gradient(145deg, #06080d, #141b27); border: 1px solid rgba(255, 255, 255, .1); }
.theme-preview-titanium i:nth-child(1) { background: #128df4; }
.theme-preview-titanium i:nth-child(2) { background: #293242; }
.theme-preview-titanium i:nth-child(3) { background: #72d7ad; }
.theme-preview-lilac { background: linear-gradient(145deg, #fff, #f0ebfb); border: 1px solid #ddd5ed; }
.theme-preview-lilac i:nth-child(1) { background: #6e56cf; }
.theme-preview-lilac i:nth-child(2) { background: #c4b5fd; }
.theme-preview-lilac i:nth-child(3) { background: #68a995; }
.theme-option-copy { display: block; min-width: 0; padding: 9px 3px 2px; }
.theme-option-copy strong,
.theme-option-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-option-copy strong { font-size: 12px; }
.theme-option-copy small { margin-top: 3px; color: var(--ui-text-muted); font-size: 9px; }
.theme-selected {
  position: absolute;
  top: 14px;
  right: 14px;
  display: none;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(7, 12, 20, .74);
  font-size: 8px;
  backdrop-filter: blur(8px);
}
.theme-option.is-selected .theme-selected { display: block; }

html.theme-changing body,
html.theme-changing .app-header,
html.theme-changing .dashboard-hero,
html.theme-changing .department-hero,
html.theme-changing .panel,
html.theme-changing .department-card,
html.theme-changing .modal-card,
html.theme-changing input,
html.theme-changing select,
html.theme-changing textarea {
  transition: color 360ms ease, background 360ms ease, border-color 360ms ease, box-shadow 360ms ease;
}

/* Moon-white violet theme. Palette follows stable Web Awesome token semantics. */
html[data-theme="lilac"] {
  color-scheme: light;
  --navy: #302842;
  --navy2: #6e56cf;
  --ink: #24202b;
  --muted: #746e7f;
  --line: rgba(61, 48, 82, .11);
  --paper: #f7f5fb;
  --blue: #6e56cf;
  --orange: #c66a4a;
  --green: #3f8c76;
  --purple: #7c5cce;
  --shadow: 0 24px 60px rgba(62, 45, 91, .10), 0 3px 12px rgba(62, 45, 91, .06);
  --ui-border: rgba(61, 48, 82, .11);
  --ui-border-strong: rgba(110, 86, 207, .28);
  --ui-surface: rgba(255, 255, 255, .76);
  --ui-surface-raised: rgba(255, 255, 255, .94);
  --ui-text: #24202b;
  --ui-text-muted: rgba(64, 56, 75, .62);
  --ui-brand: #6e56cf;
  --ui-success: #3f8c76;
  --ui-warning: #a66c26;
  --ui-danger: #c9495f;
}

html[data-theme="lilac"] body {
  color: var(--ink);
  background:
    radial-gradient(ellipse 62% 46% at 5% -8%, rgba(139, 112, 213, .17), transparent 64%),
    radial-gradient(ellipse 46% 34% at 96% 4%, rgba(165, 199, 236, .20), transparent 67%),
    radial-gradient(ellipse 55% 40% at 54% 108%, rgba(115, 177, 157, .10), transparent 72%),
    linear-gradient(150deg, #fbfafc 0%, #f6f3fa 52%, #f2f4f8 100%);
}

html[data-theme="lilac"] .login-view {
  color: var(--ink);
  background:
    radial-gradient(ellipse 55% 50% at 13% 1%, rgba(139, 112, 213, .20), transparent 68%),
    radial-gradient(ellipse 45% 38% at 88% 92%, rgba(146, 198, 224, .18), transparent 72%),
    linear-gradient(150deg, #fcfbfd, #f4f0f9 58%, #f5f7fa);
}
html[data-theme="lilac"] .login-view::before { background: radial-gradient(circle, rgba(125, 91, 203, .13), rgba(125, 91, 203, .035) 48%, transparent 72%); }
html[data-theme="lilac"] .login-view::after { opacity: .06; mix-blend-mode: multiply; }
html[data-theme="lilac"] .login-card {
  color: var(--ink);
  background: linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .68)), rgba(255, 255, 255, .82);
  border-color: rgba(77, 59, 104, .13);
  box-shadow: 0 42px 110px rgba(67, 47, 91, .16), inset 0 1px rgba(255, 255, 255, .95);
}
html[data-theme="lilac"] .login-card::before { background: linear-gradient(90deg, transparent 8%, rgba(255, 255, 255, .95) 50%, transparent 92%); }
html[data-theme="lilac"] .login-card .eyebrow { color: #75649c; }
html[data-theme="lilac"] .login-card label { color: #5c5368; }
html[data-theme="lilac"] .login-card input { color: var(--ink); background: rgba(255, 255, 255, .72); border-color: rgba(77, 59, 104, .16); }
html[data-theme="lilac"] .login-card input::placeholder { color: rgba(73, 65, 84, .42); }
html[data-theme="lilac"] .login-card .muted-light,
html[data-theme="lilac"] .login-card small { color: #766f80; }

html[data-theme="lilac"] .seal,
html[data-theme="lilac"] .mini-seal {
  color: #6e56cf;
  border-color: rgba(110, 86, 207, .34);
  background: linear-gradient(145deg, rgba(255, 255, 255, .9), rgba(237, 231, 249, .65));
  box-shadow: inset 0 1px rgba(255, 255, 255, .9), 0 8px 22px rgba(85, 60, 126, .10);
}

html[data-theme="lilac"] .app-header {
  color: var(--ink);
  background: rgba(251, 250, 253, .82);
  border-right-color: rgba(61, 48, 82, .10);
  border-bottom-color: rgba(61, 48, 82, .10);
  box-shadow: 16px 0 42px rgba(61, 45, 86, .07), inset -1px 0 rgba(255, 255, 255, .72);
}
html[data-theme="lilac"] .brand-button,
html[data-theme="lilac"] .brand-button strong { color: #2c2635; }
html[data-theme="lilac"] .brand-button small { color: rgba(69, 60, 81, .52); }
html[data-theme="lilac"] .app-nav-link { color: rgba(55, 47, 66, .66); }
html[data-theme="lilac"] .app-nav-link:hover,
html[data-theme="lilac"] .app-nav-link.is-active {
  color: #332a43;
  border-color: rgba(110, 86, 207, .17);
  background: linear-gradient(100deg, rgba(110, 86, 207, .12), rgba(255, 255, 255, .72));
}
html[data-theme="lilac"] .app-nav-link::before { box-shadow: 0 0 14px rgba(110, 86, 207, .38); }
html[data-theme="lilac"] .app-nav-link .nav-icon {
  color: rgba(87, 70, 110, .68);
  border-color: rgba(61, 48, 82, .09);
  background: rgba(255, 255, 255, .62);
}
html[data-theme="lilac"] .app-nav-link:hover .nav-icon,
html[data-theme="lilac"] .app-nav-link.is-active .nav-icon { color: #6e56cf; border-color: rgba(110, 86, 207, .20); background: rgba(110, 86, 207, .09); }
html[data-theme="lilac"] .header-actions { border-top-color: rgba(61, 48, 82, .10); }

html[data-theme="lilac"] .dashboard-hero,
html[data-theme="lilac"] .department-hero,
html[data-theme="lilac"] .panel,
html[data-theme="lilac"] .department-card,
html[data-theme="lilac"] .modal-card {
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .70) 58%, rgba(247, 243, 252, .78)),
    rgba(255, 255, 255, .78);
  border-color: rgba(61, 48, 82, .11);
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, .95);
}
html[data-theme="lilac"] .dashboard-hero,
html[data-theme="lilac"] .department-hero { background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(243, 238, 251, .78)), rgba(255, 255, 255, .82); }
html[data-theme="lilac"] .dashboard-hero p:not(.eyebrow),
html[data-theme="lilac"] .department-hero p:not(.eyebrow) { color: rgba(54, 46, 65, .68); }
html[data-theme="lilac"] .eyebrow { color: #7b68a5; }
html[data-theme="lilac"] .department-card::after { background: radial-gradient(380px circle at var(--card-x, 15%) -15%, rgba(110, 86, 207, .13), transparent 48%); }
html[data-theme="lilac"] .department-card:hover {
  border-color: rgba(110, 86, 207, .22);
  background: linear-gradient(145deg, #fff, rgba(247, 242, 253, .9));
  box-shadow: 0 28px 64px rgba(71, 50, 103, .14), inset 0 1px #fff;
}
html[data-theme="lilac"] .department-icon {
  color: #6e56cf;
  border-color: rgba(110, 86, 207, .14);
  background: linear-gradient(145deg, rgba(117, 91, 205, .12), rgba(255, 255, 255, .72));
  box-shadow: inset 0 1px #fff, 0 10px 22px rgba(70, 46, 110, .10);
}
html[data-theme="lilac"] .political .department-icon { color: #ba674d; border-color: rgba(186, 103, 77, .14); background: linear-gradient(145deg, rgba(229, 151, 123, .14), rgba(255, 255, 255, .72)); }
html[data-theme="lilac"] .logistics .department-icon { color: #3f8c76; border-color: rgba(63, 140, 118, .14); background: linear-gradient(145deg, rgba(90, 177, 151, .14), rgba(255, 255, 255, .72)); }
html[data-theme="lilac"] .department-copy small,
html[data-theme="lilac"] .department-bottom em,
html[data-theme="lilac"] .section-title > span,
html[data-theme="lilac"] .backup-message { color: var(--muted); }
html[data-theme="lilac"] .department-bottom b { color: #6750c2; }
html[data-theme="lilac"] .panel-heading,
html[data-theme="lilac"] .record-row { border-color: rgba(61, 48, 82, .09); }

html[data-theme="lilac"] input,
html[data-theme="lilac"] select,
html[data-theme="lilac"] textarea {
  color: #2b2632;
  background: rgba(255, 255, 255, .82);
  border-color: rgba(61, 48, 82, .14);
  box-shadow: inset 0 1px 2px rgba(49, 34, 72, .035), 0 1px #fff;
}
html[data-theme="lilac"] input::placeholder,
html[data-theme="lilac"] textarea::placeholder { color: rgba(65, 56, 76, .38); }
html[data-theme="lilac"] input:focus,
html[data-theme="lilac"] select:focus,
html[data-theme="lilac"] textarea:focus { border-color: rgba(110, 86, 207, .52); box-shadow: 0 0 0 4px rgba(110, 86, 207, .10), inset 0 1px 2px rgba(49, 34, 72, .03); }
html[data-theme="lilac"] select option { color: #2b2632; background: #fff; }
html[data-theme="lilac"] label { color: rgba(54, 46, 65, .76); }

html[data-theme="lilac"] .button.primary,
html[data-theme="lilac"] .dashboard-hero .button.primary,
html[data-theme="lilac"] .department-hero .button.primary {
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .18), transparent 46%), linear-gradient(145deg, #8068db 0%, #6e56cf 52%, #5f46bb 100%);
  border-color: rgba(78, 55, 160, .28);
  box-shadow: 0 12px 28px rgba(92, 68, 179, .24), 0 2px 7px rgba(55, 38, 88, .12), inset 0 1px rgba(255, 255, 255, .36);
  text-shadow: 0 1px 1px rgba(57, 35, 112, .22);
}
html[data-theme="lilac"] .button.primary:hover { box-shadow: 0 16px 34px rgba(92, 68, 179, .30), 0 3px 9px rgba(55, 38, 88, .12), inset 0 1px rgba(255, 255, 255, .42); }
html[data-theme="lilac"] .button.secondary,
html[data-theme="lilac"] .button.ghost {
  color: #4d425d;
  background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(247, 244, 251, .76));
  border-color: rgba(61, 48, 82, .12);
  box-shadow: inset 0 1px #fff, 0 5px 14px rgba(57, 41, 80, .05);
}
html[data-theme="lilac"] .button.secondary:hover,
html[data-theme="lilac"] .button.ghost:hover { color: #3f3156; background: #fff; border-color: rgba(110, 86, 207, .20); }
html[data-theme="lilac"] .back-button { color: rgba(65, 55, 77, .62); }
html[data-theme="lilac"] .back-button:hover { color: #6e56cf; background: rgba(110, 86, 207, .07); }

html[data-theme="lilac"] .department-bottom em,
html[data-theme="lilac"] .child-count { color: rgba(64, 55, 75, .62); border-color: rgba(61, 48, 82, .09); background: rgba(249, 247, 252, .82); }
html[data-theme="lilac"] .record-row.is-tree::before { background: linear-gradient(rgba(110, 86, 207, .04), rgba(110, 86, 207, .24), rgba(110, 86, 207, .04)); }
html[data-theme="lilac"] .record-leading { color: rgba(76, 63, 91, .64); border-color: rgba(61, 48, 82, .10); background: rgba(248, 246, 251, .88); }
html[data-theme="lilac"] .record-row.has-children .record-leading { color: #6e56cf; border-color: rgba(110, 86, 207, .17); background: rgba(110, 86, 207, .08); }
html[data-theme="lilac"] .record-meta { color: rgba(71, 62, 82, .54); }
html[data-theme="lilac"] .department-badge { color: #5e4ab1; border-color: rgba(110, 86, 207, .12); background: rgba(110, 86, 207, .075); }
html[data-theme="lilac"] .status-badge.neutral { color: #716a7a; border-color: rgba(61, 48, 82, .09); background: rgba(61, 48, 82, .035); }
html[data-theme="lilac"] .status-badge.progress { color: #5d4bb2; border-color: rgba(110, 86, 207, .15); background: rgba(110, 86, 207, .07); }
html[data-theme="lilac"] .status-badge.success { color: #347864; border-color: rgba(63, 140, 118, .15); background: rgba(63, 140, 118, .07); }
html[data-theme="lilac"] .status-badge.muted { color: rgba(76, 69, 84, .50); border-color: rgba(61, 48, 82, .07); background: rgba(61, 48, 82, .025); }
html[data-theme="lilac"] .record-action { color: rgba(67, 57, 79, .58); }
html[data-theme="lilac"] .record-action:hover { color: #453657; border-color: rgba(110, 86, 207, .12); background: rgba(110, 86, 207, .065); }
html[data-theme="lilac"] .record-action.danger:hover { color: #bf4056; border-color: rgba(191, 64, 86, .14); background: rgba(191, 64, 86, .06); }
html[data-theme="lilac"] .record-action[data-tooltip]::after { color: #fff; border-color: rgba(55, 42, 72, .10); background: rgba(48, 38, 61, .94); box-shadow: 0 8px 24px rgba(47, 35, 64, .18); }

html[data-theme="lilac"] .setting-block { border-color: rgba(61, 48, 82, .09); background: rgba(248, 246, 251, .72); }
html[data-theme="lilac"] .setting-block p { color: var(--muted); }
html[data-theme="lilac"] .setting-icon { color: #6e56cf; border-color: rgba(110, 86, 207, .14); background: rgba(110, 86, 207, .07); }
html[data-theme="lilac"] .theme-option { color: var(--ui-text); border-color: rgba(61, 48, 82, .11); background: rgba(255, 255, 255, .76); }
html[data-theme="lilac"] .theme-option:hover { border-color: rgba(110, 86, 207, .22); background: #fff; box-shadow: 0 10px 24px rgba(68, 48, 95, .08); }
html[data-theme="lilac"] .theme-option:focus-visible { outline-color: rgba(110, 86, 207, .18); }
html[data-theme="lilac"] .theme-option.is-selected { border-color: rgba(110, 86, 207, .44); box-shadow: 0 0 0 3px rgba(110, 86, 207, .08); }
html[data-theme="lilac"] .close { color: rgba(61, 52, 72, .64); border-color: rgba(61, 48, 82, .09); background: rgba(247, 244, 250, .82); }
html[data-theme="lilac"] .close:hover { color: #43354f; background: rgba(110, 86, 207, .08); }
html[data-theme="lilac"] .modal { background: rgba(45, 34, 60, .24); }
html[data-theme="lilac"] .sync-status { color: rgba(64, 55, 75, .62); border-color: rgba(61, 48, 82, .09); background: rgba(255, 255, 255, .66); }
html[data-theme="lilac"] .empty > .icon { color: rgba(110, 86, 207, .46); }

@media (max-width: 620px) {
  .theme-options { margin-left: 0; }
  html[data-theme="lilac"] .app-header { box-shadow: 0 14px 32px rgba(61, 45, 86, .09), inset 0 -1px #fff; }
  html[data-theme="lilac"] .record-more summary { color: rgba(61, 52, 72, .62); border-color: rgba(61, 48, 82, .09); background: rgba(247, 244, 250, .86); }
  html[data-theme="lilac"] .record-more[open] summary { color: #6e56cf; border-color: rgba(110, 86, 207, .20); }
  html[data-theme="lilac"] .record-more-menu { border-color: rgba(61, 48, 82, .11); background: rgba(255, 255, 255, .97); box-shadow: 0 18px 45px rgba(58, 40, 82, .16); }
  html[data-theme="lilac"] .record-more-menu .record-action { color: rgba(51, 43, 61, .74); }
  html[data-theme="lilac"] .form-actions { background: rgba(255, 255, 255, .96); }
}

@media (max-width: 380px) {
  .theme-options { grid-template-columns: 1fr; }
}

/* Tang paper theme: warm paper, cinnabar, jade and restrained bronze. */
html[data-theme="tang"] {
  color-scheme: light;
  --navy: #3b3831;
  --navy2: #a73e32;
  --ink: #2f342f;
  --muted: #77736a;
  --line: rgba(86, 75, 58, .11);
  --paper: #f5efdf;
  --blue: #a73e32;
  --orange: #aa753b;
  --green: #3b7569;
  --purple: #a73e32;
  --shadow: 0 24px 60px rgba(94, 68, 43, .10), 0 3px 12px rgba(94, 68, 43, .06);
  --ui-border: rgba(86, 75, 58, .11);
  --ui-border-strong: rgba(167, 62, 50, .28);
  --ui-surface: rgba(255, 252, 243, .76);
  --ui-surface-raised: rgba(255, 252, 243, .94);
  --ui-text: #2f342f;
  --ui-text-muted: rgba(82, 77, 65, .62);
  --ui-brand: #a73e32;
  --ui-success: #3b7569;
  --ui-warning: #a66c26;
  --ui-danger: #c9495f;
}

html[data-theme="tang"] body {
  color: var(--ink);
  background:
    radial-gradient(ellipse 62% 46% at 5% -8%, rgba(171, 96, 66, .17), transparent 64%),
    radial-gradient(ellipse 46% 34% at 96% 4%, rgba(135, 176, 161, .20), transparent 67%),
    radial-gradient(ellipse 55% 40% at 54% 108%, rgba(172, 136, 85, .10), transparent 72%),
    linear-gradient(150deg, #faf6eb 0%, #f5efdf 52%, #eee9d9 100%);
}

html[data-theme="tang"] .login-view {
  color: var(--ink);
  background:
    radial-gradient(ellipse 55% 50% at 13% 1%, rgba(171, 96, 66, .20), transparent 68%),
    radial-gradient(ellipse 45% 38% at 88% 92%, rgba(135, 176, 161, .18), transparent 72%),
    linear-gradient(150deg, #fbf7ec, #f4eddb 58%, #eee8d8);
}
html[data-theme="tang"] .login-view::before { background: radial-gradient(circle, rgba(167, 62, 50, .13), rgba(167, 62, 50, .035) 48%, transparent 72%); }
html[data-theme="tang"] .login-view::after { opacity: .06; mix-blend-mode: multiply; }
html[data-theme="tang"] .login-card {
  color: var(--ink);
  background: linear-gradient(145deg, rgba(255, 252, 243, .94), rgba(255, 252, 243, .68)), rgba(255, 252, 243, .82);
  border-color: rgba(86, 75, 58, .13);
  box-shadow: 0 42px 110px rgba(94, 68, 43, .16), inset 0 1px rgba(255, 252, 243, .95);
}
html[data-theme="tang"] .login-card::before { background: linear-gradient(90deg, transparent 8%, rgba(255, 252, 243, .95) 50%, transparent 92%); }
html[data-theme="tang"] .login-card .eyebrow { color: #865941; }
html[data-theme="tang"] .login-card label { color: #625e55; }
html[data-theme="tang"] .login-card input { color: var(--ink); background: rgba(255, 252, 243, .72); border-color: rgba(86, 75, 58, .16); }
html[data-theme="tang"] .login-card input::placeholder { color: rgba(83, 75, 63, .42); }
html[data-theme="tang"] .login-card .muted-light,
html[data-theme="tang"] .login-card small { color: #787166; }

html[data-theme="tang"] .seal,
html[data-theme="tang"] .mini-seal {
  color: #a73e32;
  border-color: rgba(167, 62, 50, .34);
  background: linear-gradient(145deg, rgba(255, 252, 243, .9), rgba(237, 231, 249, .65));
  box-shadow: inset 0 1px rgba(255, 252, 243, .9), 0 8px 22px rgba(108, 75, 50, .10);
}

html[data-theme="tang"] .app-header {
  color: var(--ink);
  background: rgba(251, 250, 253, .82);
  border-right-color: rgba(86, 75, 58, .10);
  border-bottom-color: rgba(86, 75, 58, .10);
  box-shadow: 16px 0 42px rgba(91, 70, 47, .07), inset -1px 0 rgba(255, 252, 243, .72);
}
html[data-theme="tang"] .brand-button,
html[data-theme="tang"] .brand-button strong { color: #30352f; }
html[data-theme="tang"] .brand-button small { color: rgba(80, 72, 59, .52); }
html[data-theme="tang"] .app-nav-link { color: rgba(68, 67, 57, .66); }
html[data-theme="tang"] .app-nav-link:hover,
html[data-theme="tang"] .app-nav-link.is-active {
  color: #303b35;
  border-color: rgba(167, 62, 50, .17);
  background: linear-gradient(100deg, rgba(167, 62, 50, .12), rgba(255, 252, 243, .72));
}
html[data-theme="tang"] .app-nav-link::before { box-shadow: 0 0 14px rgba(167, 62, 50, .38); }
html[data-theme="tang"] .app-nav-link .nav-icon {
  color: rgba(86, 81, 66, .68);
  border-color: rgba(86, 75, 58, .09);
  background: rgba(255, 252, 243, .62);
}
html[data-theme="tang"] .app-nav-link:hover .nav-icon,
html[data-theme="tang"] .app-nav-link.is-active .nav-icon { color: #a73e32; border-color: rgba(167, 62, 50, .20); background: rgba(167, 62, 50, .09); }
html[data-theme="tang"] .header-actions { border-top-color: rgba(86, 75, 58, .10); }

html[data-theme="tang"] .dashboard-hero,
html[data-theme="tang"] .department-hero,
html[data-theme="tang"] .panel,
html[data-theme="tang"] .department-card,
html[data-theme="tang"] .modal-card {
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 252, 243, .92), rgba(250, 244, 228, .72) 58%, rgba(247, 238, 219, .78)),
    rgba(255, 252, 243, .78);
  border-color: rgba(86, 75, 58, .11);
  box-shadow: var(--shadow), inset 0 1px rgba(255, 252, 243, .95);
}
html[data-theme="tang"] .dashboard-hero,
html[data-theme="tang"] .department-hero { background: linear-gradient(135deg, rgba(255, 252, 243, .96), rgba(240, 227, 202, .78)), rgba(255, 252, 243, .82); }
html[data-theme="tang"] .dashboard-hero p:not(.eyebrow),
html[data-theme="tang"] .department-hero p:not(.eyebrow) { color: rgba(73, 69, 57, .68); }
html[data-theme="tang"] .eyebrow { color: #8d6445; }
html[data-theme="tang"] .department-card::after { background: radial-gradient(380px circle at var(--card-x, 15%) -15%, rgba(167, 62, 50, .13), transparent 48%); }
html[data-theme="tang"] .department-card:hover {
  border-color: rgba(167, 62, 50, .22);
  background: linear-gradient(145deg, #fff, rgba(247, 238, 219, .9));
  box-shadow: 0 28px 64px rgba(95, 71, 47, .14), inset 0 1px #fff;
}
html[data-theme="tang"] .department-icon {
  color: #a73e32;
  border-color: rgba(167, 62, 50, .14);
  background: linear-gradient(145deg, rgba(174, 83, 64, .12), rgba(255, 252, 243, .72));
  box-shadow: inset 0 1px #fff, 0 10px 22px rgba(95, 71, 47, .10);
}
html[data-theme="tang"] .political .department-icon { color: #a7753f; border-color: rgba(167, 117, 63, .14); background: linear-gradient(145deg, rgba(199, 156, 100, .14), rgba(255, 252, 243, .72)); }
html[data-theme="tang"] .logistics .department-icon { color: #3b7569; border-color: rgba(59, 117, 105, .14); background: linear-gradient(145deg, rgba(95, 151, 128, .14), rgba(255, 252, 243, .72)); }
html[data-theme="tang"] .department-copy small,
html[data-theme="tang"] .department-bottom em,
html[data-theme="tang"] .section-title > span,
html[data-theme="tang"] .backup-message { color: var(--muted); }
html[data-theme="tang"] .department-bottom b { color: #a73e32; }
html[data-theme="tang"] .panel-heading,
html[data-theme="tang"] .record-row { border-color: rgba(86, 75, 58, .09); }

html[data-theme="tang"] input,
html[data-theme="tang"] select,
html[data-theme="tang"] textarea {
  color: #30352f;
  background: rgba(255, 252, 243, .82);
  border-color: rgba(86, 75, 58, .14);
  box-shadow: inset 0 1px 2px rgba(86, 75, 58, .035), 0 1px #fff;
}
html[data-theme="tang"] input::placeholder,
html[data-theme="tang"] textarea::placeholder { color: rgba(83, 75, 63, .38); }
html[data-theme="tang"] input:focus,
html[data-theme="tang"] select:focus,
html[data-theme="tang"] textarea:focus { border-color: rgba(167, 62, 50, .52); box-shadow: 0 0 0 4px rgba(167, 62, 50, .10), inset 0 1px 2px rgba(86, 75, 58, .03); }
html[data-theme="tang"] select option { color: #30352f; background: #fff; }
html[data-theme="tang"] label { color: rgba(73, 69, 57, .76); }

html[data-theme="tang"] .button.primary,
html[data-theme="tang"] .dashboard-hero .button.primary,
html[data-theme="tang"] .department-hero .button.primary {
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 252, 243, .18), transparent 46%), linear-gradient(145deg, #bd5947 0%, #a73e32 52%, #87372f 100%);
  border-color: rgba(133, 51, 42, .28);
  box-shadow: 0 12px 28px rgba(142, 57, 46, .24), 0 2px 7px rgba(91, 55, 42, .12), inset 0 1px rgba(255, 252, 243, .36);
  text-shadow: 0 1px 1px rgba(91, 43, 36, .22);
}
html[data-theme="tang"] .button.primary:hover { box-shadow: 0 16px 34px rgba(142, 57, 46, .30), 0 3px 9px rgba(91, 55, 42, .12), inset 0 1px rgba(255, 252, 243, .42); }
html[data-theme="tang"] .button.secondary,
html[data-theme="tang"] .button.ghost {
  color: #514d43;
  background: linear-gradient(180deg, rgba(255, 252, 243, .9), rgba(248, 241, 224, .76));
  border-color: rgba(86, 75, 58, .12);
  box-shadow: inset 0 1px #fff, 0 5px 14px rgba(87, 69, 50, .05);
}
html[data-theme="tang"] .button.secondary:hover,
html[data-theme="tang"] .button.ghost:hover { color: #403d34; background: #fff; border-color: rgba(167, 62, 50, .20); }
html[data-theme="tang"] .back-button { color: rgba(81, 73, 59, .62); }
html[data-theme="tang"] .back-button:hover { color: #a73e32; background: rgba(167, 62, 50, .07); }

html[data-theme="tang"] .department-bottom em,
html[data-theme="tang"] .child-count { color: rgba(85, 79, 67, .62); border-color: rgba(86, 75, 58, .09); background: rgba(249, 244, 231, .82); }
html[data-theme="tang"] .record-row.is-tree::before { background: linear-gradient(rgba(167, 62, 50, .04), rgba(167, 62, 50, .24), rgba(167, 62, 50, .04)); }
html[data-theme="tang"] .record-leading { color: rgba(81, 78, 65, .64); border-color: rgba(86, 75, 58, .10); background: rgba(248, 242, 226, .88); }
html[data-theme="tang"] .record-row.has-children .record-leading { color: #a73e32; border-color: rgba(167, 62, 50, .17); background: rgba(167, 62, 50, .08); }
html[data-theme="tang"] .record-meta { color: rgba(82, 77, 65, .54); }
html[data-theme="tang"] .department-badge { color: #984136; border-color: rgba(167, 62, 50, .12); background: rgba(167, 62, 50, .075); }
html[data-theme="tang"] .status-badge.neutral { color: #706a60; border-color: rgba(86, 75, 58, .09); background: rgba(86, 75, 58, .035); }
html[data-theme="tang"] .status-badge.progress { color: #9b493a; border-color: rgba(167, 62, 50, .15); background: rgba(167, 62, 50, .07); }
html[data-theme="tang"] .status-badge.success { color: #386e61; border-color: rgba(59, 117, 105, .15); background: rgba(59, 117, 105, .07); }
html[data-theme="tang"] .status-badge.muted { color: rgba(82, 77, 65, .50); border-color: rgba(86, 75, 58, .07); background: rgba(86, 75, 58, .025); }
html[data-theme="tang"] .record-action { color: rgba(83, 75, 63, .58); }
html[data-theme="tang"] .record-action:hover { color: #55443b; border-color: rgba(167, 62, 50, .12); background: rgba(167, 62, 50, .065); }
html[data-theme="tang"] .record-action.danger:hover { color: #b44339; border-color: rgba(180, 67, 57, .14); background: rgba(180, 67, 57, .06); }
html[data-theme="tang"] .record-action[data-tooltip]::after { color: #fff; border-color: rgba(78, 60, 46, .10); background: rgba(55, 49, 39, .94); box-shadow: 0 8px 24px rgba(62, 49, 37, .18); }

html[data-theme="tang"] .setting-block { border-color: rgba(86, 75, 58, .09); background: rgba(248, 242, 226, .72); }
html[data-theme="tang"] .setting-block p { color: var(--muted); }
html[data-theme="tang"] .setting-icon { color: #a73e32; border-color: rgba(167, 62, 50, .14); background: rgba(167, 62, 50, .07); }
html[data-theme="tang"] .theme-option { color: var(--ui-text); border-color: rgba(86, 75, 58, .11); background: rgba(255, 252, 243, .76); }
html[data-theme="tang"] .theme-option:hover { border-color: rgba(167, 62, 50, .22); background: #fff; box-shadow: 0 10px 24px rgba(91, 68, 45, .08); }
html[data-theme="tang"] .theme-option:focus-visible { outline-color: rgba(167, 62, 50, .18); }
html[data-theme="tang"] .theme-option.is-selected { border-color: rgba(167, 62, 50, .44); box-shadow: 0 0 0 3px rgba(167, 62, 50, .08); }
html[data-theme="tang"] .close { color: rgba(81, 73, 59, .64); border-color: rgba(86, 75, 58, .09); background: rgba(247, 244, 250, .82); }
html[data-theme="tang"] .close:hover { color: #55443b; background: rgba(167, 62, 50, .08); }
html[data-theme="tang"] .modal { background: rgba(54, 46, 36, .24); }
html[data-theme="tang"] .sync-status { color: rgba(85, 79, 67, .62); border-color: rgba(86, 75, 58, .09); background: rgba(255, 252, 243, .66); }
html[data-theme="tang"] .empty > .icon { color: rgba(167, 62, 50, .46); }

@media (max-width: 620px) {
  .theme-options { margin-left: 0; }
  html[data-theme="tang"] .app-header { box-shadow: 0 14px 32px rgba(91, 70, 47, .09), inset 0 -1px #fff; }
  html[data-theme="tang"] .record-more summary { color: rgba(81, 73, 59, .62); border-color: rgba(86, 75, 58, .09); background: rgba(247, 244, 250, .86); }
  html[data-theme="tang"] .record-more[open] summary { color: #a73e32; border-color: rgba(167, 62, 50, .20); }
  html[data-theme="tang"] .record-more-menu { border-color: rgba(86, 75, 58, .11); background: rgba(255, 252, 243, .97); box-shadow: 0 18px 45px rgba(88, 67, 48, .16); }
  html[data-theme="tang"] .record-more-menu .record-action { color: rgba(70, 64, 54, .74); }
  html[data-theme="tang"] .form-actions { background: rgba(255, 252, 243, .96); }
}

@media (max-width: 380px) {
  .theme-options { grid-template-columns: 1fr; }
}


.theme-preview-tang { background: linear-gradient(145deg, #fbf7e9, #e8d7b9); border: 1px solid #d9c7a3; }
.theme-preview-tang i:nth-child(1) { background: #a73e32; }
.theme-preview-tang i:nth-child(2) { background: #3b7569; }
.theme-preview-tang i:nth-child(3) { background: #ad854e; }
html[data-theme="tang"] .login-card h1 { font-family: "Noto Serif CJK SC", "Songti SC", "SimSun", serif; letter-spacing: .06em; }
html[data-theme="tang"] .brand-button strong, html[data-theme="tang"] .dashboard-hero h2, html[data-theme="tang"] .department-hero h2 { font-family: "Noto Serif CJK SC", "Songti SC", "SimSun", serif; letter-spacing: .03em; }
html[data-theme="tang"] .theme-preview-tang { box-shadow: inset 0 1px rgba(255, 255, 255, .8); }
/* Mobile utility access: keep theme settings reachable without crowding the header. */
@media (max-width: 620px) {
  .header-actions { max-width: 48%; }
  .header-actions #headerQuickAdd { flex: 0 1 auto; }
  .header-actions #settingsBtn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    flex: 0 0 38px;
    padding: 0;
    border-radius: 11px;
  }
  .header-actions #settingsBtn span { display: none; }
  .header-actions #settingsBtn::before { content: none; }
  .header-actions #settingsBtn .icon { width: 17px; height: 17px; }
  html[data-theme="lilac"] .header-actions #settingsBtn {
    color: #5d4ca2;
    border-color: rgba(110, 86, 207, .13);
    background: rgba(255, 255, 255, .68);
    box-shadow: inset 0 1px #fff, 0 5px 14px rgba(57, 41, 80, .05);
  }
}

@media (max-width: 340px) {
  .brand-button strong { max-width: 104px; }
  .brand-button small { display: none; }
  .header-actions #headerQuickAdd {
    width: 38px;
    min-width: 38px;
    flex: 0 0 38px;
    padding: 0;
  }
  .header-actions #headerQuickAdd span { display: none; }
}

.sync-status {margin:0 0 16px;color:#93a5ba;font-size:13px;overflow-wrap:anywhere;}
.form-error {color:#b42318;margin-top:12px;white-space:pre-wrap;}
.login-card .error {height:auto;min-height:18px;}
button:disabled {opacity:.55;cursor:wait;transform:none;}
@media(max-width:620px){
 .app-header {height:auto;min-height:70px;flex-wrap:wrap;gap:8px;padding-bottom:8px;}
 .brand-button strong {max-width:none;font-size:14px;}
 .department-heading {min-width:0;}
 .department-hero {flex-wrap:wrap;}
 .dashboard-hero {flex-wrap:wrap;}
}
