:root {
  --ink: #17211e;
  --muted: #68736f;
  --line: #dfe5e2;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --forest: #17332b;
  --green: #247a5b;
  --green-soft: #e7f4ee;
  --amber: #a86212;
  --amber-soft: #fff3de;
  --coral: #b8493f;
  --coral-soft: #fdecea;
  --blue: #326b8c;
  --blue-soft: #eaf3f8;
  --shadow: 0 16px 50px rgba(26, 42, 36, .12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--soft);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; background: var(--soft); }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button, select, input[type="date"], input[type="datetime-local"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 122, 91, .22); outline-offset: 2px; }
a { color: var(--green); text-decoration: none; }
svg { width: 18px; height: 18px; stroke-width: 1.9; flex: 0 0 auto; }
.hidden { display: none !important; }

.boot-view { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 10px; background: var(--soft); }
.boot-view .brand-mark { margin-bottom: 4px; }
.boot-view strong { font-size: 17px; }
.boot-view > span:last-child { color: var(--muted); font-size: 12px; }

.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-lockup > div { display: grid; gap: 2px; min-width: 0; }
.brand-lockup strong { font-size: 17px; line-height: 1.3; }
.brand-lockup span:not(.brand-mark) { font-size: 12px; color: #789087; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; background: #d7eadf; color: var(--forest); font-weight: 800; }

.auth-view { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 28px; background: #edf2ef; }
.auth-main { width: min(980px, 100%); min-height: 600px; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--paper); box-shadow: var(--shadow); border: 1px solid #d8e0dc; border-radius: 8px; overflow: hidden; }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; background: var(--forest); color: white; }
.auth-brand .brand-mark { background: #b8dbc9; }
.auth-brand .brand-lockup span:not(.brand-mark) { color: #a9c0b8; }
.auth-wordmark { align-self: flex-end; color: rgba(255,255,255,.12); font-size: 96px; font-weight: 800; line-height: 1; }
.auth-panel { align-self: center; padding: 64px; }
.mobile-brand { display: none; }
.auth-copy { margin-bottom: 34px; }
.eyebrow, .page-kicker { margin: 0 0 7px; font-size: 12px; font-weight: 700; color: var(--green); }
.auth-copy h1 { margin: 0; font-size: 28px; line-height: 1.35; }
.auth-copy > p:last-child { margin: 12px 0 0; font-size: 14px; line-height: 1.8; color: var(--muted); }
.auth-panel > .button { width: 100%; }
.text-button { display: block; margin: 18px auto 0; border: 0; background: none; color: var(--muted); font-size: 13px; }
.text-button:hover { color: var(--green); }
.local-login { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.local-login label { display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.form-message { min-height: 20px; margin: 15px 0 0; color: var(--coral); font-size: 13px; text-align: center; }

.app-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 26px 18px 18px; display: flex; flex-direction: column; background: var(--forest); color: white; }
.sidebar-brand { padding: 0 8px 28px; }
.sidebar-brand .brand-mark { background: #b8dbc9; }
.sidebar-brand .brand-lockup span { color: #abc0b8; }
.primary-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; height: 46px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: 6px; background: transparent; color: #afc0ba; text-align: left; font-size: 14px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { color: #18372e; background: #c5e4d4; font-weight: 700; }
.sidebar-foot { margin-top: auto; min-height: 60px; padding: 15px 5px 0; border-top: 1px solid rgba(255,255,255,.12); display: grid; grid-template-columns: 1fr 36px; gap: 8px; align-items: center; }
.user-chip { min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 9px; align-items: center; }
.user-chip .avatar { grid-row: 1 / 3; }
.user-chip strong, .user-chip small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: #9fb4ac; font-size: 11px; }
.sidebar .icon-button { color: #9fb4ac; }
.sidebar .icon-button:hover { color: white; background: rgba(255,255,255,.08); }

.workspace { min-width: 0; }
.topbar { height: 88px; padding: 18px 34px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 0; font-size: 21px; line-height: 1.25; }
.page-kicker { color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.today-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.avatar-button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; overflow: hidden; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #dbe9e2; color: var(--forest); font-size: 12px; font-weight: 800; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-button .avatar { width: 38px; height: 38px; }

.content { width: min(1480px, 100%); min-height: calc(100vh - 88px); margin: 0 auto; padding: 28px 34px 48px; }
.content-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 20px; }
.content-head h2 { margin: 0; font-size: 18px; }
.content-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.content-actions { display: flex; gap: 8px; align-items: center; }
.button { min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: #1d674c; }
.button.secondary { background: var(--forest); color: white; }
.button.ghost { background: white; border-color: var(--line); color: #3f4a46; }
.button.ghost:hover { border-color: #aebbb5; background: var(--soft); }
.button.danger { background: var(--coral-soft); color: var(--coral); border-color: #f3c9c5; }
.button.small { min-height: 32px; padding: 0 11px; font-size: 12px; }
.button.large { min-height: 48px; font-size: 14px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; display: inline-grid; place-items: center; background: transparent; }
.icon-button:hover { background: var(--soft); }

.date-strip { width: 100%; display: grid; grid-template-columns: repeat(7, minmax(70px, 1fr)); gap: 6px; margin-bottom: 22px; overflow-x: auto; scrollbar-width: thin; }
.date-chip { min-height: 62px; padding: 9px 6px; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; gap: 3px; background: var(--paper); color: var(--muted); }
.date-chip span { font-size: 11px; }
.date-chip strong { font-size: 16px; color: var(--ink); }
.date-chip.active { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.date-chip.active strong { color: var(--green); }
.date-chip.today:not(.active)::after { content: "今天"; font-size: 10px; color: var(--green); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--paper); margin-bottom: 24px; }
.stat { min-height: 108px; padding: 20px 22px; display: grid; grid-template-columns: 1fr 36px; gap: 8px; align-items: center; }
.stat:not(:last-child) { border-right: 1px solid var(--line); }
.stat span { align-self: end; color: var(--muted); font-size: 12px; }
.stat strong { align-self: start; font-size: 28px; line-height: 1; }
.stat-icon { grid-column: 2; grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; }
.stat:nth-child(1) .stat-icon { color: var(--blue); background: var(--blue-soft); }
.stat:nth-child(2) .stat-icon { color: var(--amber); background: var(--amber-soft); }
.stat:nth-child(3) .stat-icon { color: var(--coral); background: var(--coral-soft); }
.stat:nth-child(4) .stat-icon { color: var(--green); background: var(--green-soft); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 24px; align-items: start; }
.work-section, .activity-section { min-width: 0; }
.section-head { min-height: 44px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0 0 4px; font-size: 16px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-head .count { min-width: 28px; height: 24px; padding: 0 8px; border-radius: 12px; display: inline-grid; place-items: center; background: #e7ece9; color: #4e5b56; font-size: 12px; }
.task-list { display: grid; }
.task-row { min-width: 0; min-height: 96px; padding: 16px 4px; display: grid; grid-template-columns: 76px minmax(0, 1fr) 110px auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.task-time { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.task-time strong { font-size: 15px; color: var(--ink); }
.task-main { min-width: 0; }
.task-main h3 { margin: 0 0 7px; font-size: 14px; overflow-wrap: anywhere; }
.task-meta { min-width: 0; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.task-meta span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.task-assignee { display: flex; gap: 8px; align-items: center; min-width: 0; color: #45514c; font-size: 12px; }
.task-assignee span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.status-badge, .type-badge, .priority-badge { height: 24px; padding: 0 8px; border-radius: 4px; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; white-space: nowrap; }
.status-pending { background: #edf0ef; color: #58635f; }
.status-in_progress { background: var(--blue-soft); color: var(--blue); }
.status-submitted { background: var(--amber-soft); color: var(--amber); }
.status-approved { background: var(--green-soft); color: var(--green); }
.status-rejected { background: var(--coral-soft); color: var(--coral); }
.status-cancelled { background: #f0f0f0; color: #8b8f8d; }
.priority-urgent { color: var(--coral); font-weight: 700; }
.priority-high { color: var(--amber); font-weight: 700; }
.overdue { color: var(--coral) !important; }

.activity-list { display: grid; }
.activity-item { min-height: 78px; padding: 14px 2px; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--line); }
.activity-item > div { min-width: 0; }
.activity-item p { margin: 1px 0 6px; font-size: 12px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.activity-item small { color: var(--muted); font-size: 10px; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.empty-state svg { width: 32px; height: 32px; color: #9eaaa5; }
.empty-state strong { color: #45514c; font-size: 14px; }
.empty-state span { font-size: 12px; }

.filter-bar { padding: 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--paper); border-radius: 7px; display: grid; grid-template-columns: 1fr 150px 160px auto; gap: 10px; align-items: center; }
.search-field { position: relative; min-width: 0; }
.search-field svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #8b9692; }
.search-field input { width: 100%; padding-left: 35px; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid #cfd8d4; border-radius: 5px; background: white; color: var(--ink); }
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: #abb9b3; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 2px solid rgba(36,122,91,.1); }

.data-panel { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--paper); }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 42px; padding: 0 14px; background: #f7f9f8; color: var(--muted); font-size: 11px; text-align: left; font-weight: 700; }
.data-table td { height: 64px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; vertical-align: middle; overflow-wrap: anywhere; }
.data-table tr:hover td { background: #fafcfb; }
.data-table .primary-cell { display: grid; gap: 4px; }
.data-table .primary-cell strong { font-size: 13px; }
.data-table .primary-cell small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; }
.progress-track { width: 100%; height: 6px; border-radius: 3px; background: #e8ecea; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--green); }
.mobile-list { display: none; }

.team-list { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 12px; }
.member-card { min-height: 112px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: start; }
.member-card .avatar { width: 42px; height: 42px; }
.member-info { min-width: 0; }
.member-info h3 { margin: 1px 0 5px; font-size: 14px; }
.member-info p { margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-controls { grid-column: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.member-controls select { height: 32px; font-size: 11px; }
.member-controls .button { grid-column: 1 / 3; }
.member-actions { grid-column: 1 / 3; display: flex; gap: 8px; }
.member-actions .button { min-width: 0; flex: 1; }
.danger-icon { color: var(--red); }
.danger-icon:hover { color: #74352f; background: #f8eeec; }

.integration-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 7px; background: var(--paper); overflow: hidden; }
.integration-metric { position: relative; min-height: 108px; padding: 18px; display: grid; align-content: center; gap: 7px; border-right: 1px solid var(--line); }
.integration-metric:last-child { border-right: 0; }
.integration-metric span, .integration-metric small { color: var(--muted); font-size: 11px; }
.integration-metric strong { font-size: 20px; line-height: 1.25; overflow-wrap: anywhere; }
.status-dot { position: absolute; top: 18px; right: 18px; width: 8px; height: 8px; border-radius: 50%; background: #9ba6a1; }
.status-dot.success { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-dot.failed { background: var(--red); box-shadow: 0 0 0 4px #f8eeec; }
.integration-config { margin-top: 14px; padding: 4px 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.config-line { min-height: 48px; display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.config-line span { color: var(--muted); font-size: 11px; }
.config-line code, .config-line strong { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.config-line code { color: #315449; }
.integration-message { margin: 12px 0; padding: 11px 12px; display: flex; align-items: flex-start; gap: 9px; border-radius: 5px; background: var(--green-soft); color: #245b48; font-size: 12px; line-height: 1.55; }
.integration-message.failed { background: #f8eeec; color: #74352f; }
.integration-message svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.integration-history { margin-top: 14px; }
.department-role-panel { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.department-role-panel .section-head { margin-bottom: 4px; }
.department-role-panel h3 { margin: 0; font-size: 15px; }
.department-role-panel p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.department-role-list { display: grid; }
.department-role-row { min-height: 64px; display: grid; grid-template-columns: minmax(0, 1fr) 160px 132px; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }
.department-role-row:last-child { border-bottom: 0; }
.department-role-row > div { min-width: 0; display: grid; gap: 4px; }
.department-role-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.department-role-row small { color: var(--muted); font-size: 11px; }
.department-role-row select { min-width: 0; }
.mapping-empty { padding: 18px 0 4px; }

.modal { width: min(680px, calc(100% - 28px)); max-height: min(88vh, 900px); padding: 0; border: 0; border-radius: 8px; box-shadow: var(--shadow); color: var(--ink); overflow: hidden; }
.modal::backdrop { background: rgba(16, 27, 23, .58); backdrop-filter: blur(2px); }
.wide-modal { width: min(920px, calc(100% - 28px)); }
.compact-modal { width: min(520px, calc(100% - 28px)); }
.modal > form, .modal > div { max-height: inherit; display: flex; flex-direction: column; }
.modal-head { min-height: 76px; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-actions { min-height: 68px; padding: 13px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 8px; background: #fafcfb; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 16px; }
.form-grid .span-2 { grid-column: 1 / 3; }
.form-grid label, .form-stack label { display: grid; gap: 7px; align-content: start; color: #59645f; font-size: 12px; font-weight: 600; }
.form-stack { display: grid; gap: 18px; }
.form-stack input[type="range"] { padding: 0; border: 0; accent-color: var(--green); }
.field-help { margin: -10px 0 0; color: var(--muted); font-size: 11px; }
.segmented { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented legend { margin-bottom: 8px; color: #59645f; font-size: 12px; font-weight: 600; }
.segmented label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label span { height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: white; font-size: 12px; }
.segmented label input:checked + span { color: var(--green); border-color: var(--green); background: var(--green-soft); font-weight: 700; }

.detail-summary { padding: 22px; border-bottom: 1px solid var(--line); }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-title-row h2 { margin: 4px 0 8px; font-size: 20px; overflow-wrap: anywhere; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.detail-field { display: grid; gap: 5px; }
.detail-field span { color: var(--muted); font-size: 10px; }
.detail-field strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.detail-copy { margin-top: 18px; display: grid; gap: 12px; }
.detail-copy div { padding: 12px 14px; border-left: 3px solid #bfd3ca; background: var(--soft); }
.detail-copy span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.detail-copy p { margin: 0; white-space: pre-wrap; font-size: 12px; line-height: 1.7; }
.detail-history { padding: 20px 22px; overflow-y: auto; }
.detail-history h3 { margin: 0 0 14px; font-size: 14px; }
.timeline { display: grid; }
.timeline-item { position: relative; padding: 0 0 18px 28px; }
.timeline-item::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: -6px; border-left: 1px solid var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 2px; top: 4px; width: 11px; height: 11px; border: 2px solid var(--green); border-radius: 50%; background: white; }
.timeline-item.review .timeline-dot { border-color: var(--amber); }
.timeline-head { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.timeline-head strong { font-size: 12px; }
.timeline-head time { color: var(--muted); }
.timeline-item p { margin: 7px 0 0; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.toast-region { position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 30px)); min-height: 48px; padding: 12px 14px; border-radius: 6px; display: flex; align-items: center; gap: 10px; background: var(--forest); color: white; box-shadow: 0 10px 28px rgba(20, 37, 31, .2); font-size: 12px; animation: toast-in .18s ease-out; }
.toast.error { background: #74352f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.skeleton { min-height: 20px; border-radius: 4px; background: #e5ebe8; animation: pulse 1.2s infinite alternate; }
@keyframes pulse { to { opacity: .45; } }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .team-list { grid-template-columns: repeat(2, minmax(230px, 1fr)); }
  .task-row { grid-template-columns: 68px minmax(0, 1fr) auto; }
  .task-assignee { display: none; }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 72px; padding: 12px 18px; }
  .topbar h1 { font-size: 18px; }
  .page-kicker, .today-label, .topbar .operator-only { display: none !important; }
  .content { min-height: calc(100vh - 136px); padding: 18px 16px 92px; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); padding: 7px 10px env(safe-area-inset-bottom); display: flex; align-items: center; justify-content: space-around; background: rgba(255,255,255,.98); border-top: 1px solid var(--line); }
  .mobile-nav button { width: 58px; height: 50px; padding: 0; border: 0; background: transparent; color: #7a8581; display: grid; place-items: center; align-content: center; gap: 4px; font-size: 10px; }
  .mobile-nav button svg { width: 20px; height: 20px; }
  .mobile-nav button.active { color: var(--green); font-weight: 700; }
  .mobile-nav .mobile-add { width: 46px; height: 46px; margin-top: -24px; border-radius: 50%; background: var(--green); color: white; box-shadow: 0 7px 18px rgba(36,122,91,.28); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 86px; padding: 15px 16px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .stat strong { font-size: 23px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 26px; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .search-field { grid-column: 1 / 3; }
  .data-table-wrap { display: none; }
  .mobile-list { display: grid; }
  .mobile-data-card { padding: 15px 3px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
  .mobile-data-card h3 { margin: 0; font-size: 14px; }
  .mobile-data-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
  .mobile-data-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; }
  .mobile-data-actions { display: flex; gap: 7px; }
  .integration-summary { grid-template-columns: 1fr 1fr; }
  .integration-metric:nth-child(2) { border-right: 0; }
  .integration-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .auth-view { padding: 0; background: white; place-items: stretch; }
  .auth-main { min-height: 100vh; min-height: 100dvh; display: block; border: 0; border-radius: 0; box-shadow: none; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; min-height: 100dvh; padding: max(32px, env(safe-area-inset-top)) 24px 36px; display: flex; flex-direction: column; justify-content: center; }
  .mobile-brand { display: flex; position: absolute; top: max(24px, env(safe-area-inset-top)); }
  .auth-copy h1 { font-size: 24px; }
  .topbar { padding: 11px 14px; }
  .topbar-actions { gap: 8px; }
  .content { padding: 16px 14px 88px; }
  .content-head { align-items: flex-start; }
  .content-head p { max-width: 230px; line-height: 1.55; }
  .date-strip { grid-template-columns: repeat(7, 64px); padding-bottom: 4px; }
  .date-strip { scrollbar-width: none; }
  .date-strip::-webkit-scrollbar { display: none; }
  .date-chip { min-height: 58px; }
  .task-row { padding: 15px 1px; grid-template-columns: 56px minmax(0, 1fr); gap: 11px; align-items: start; }
  .task-time strong { font-size: 13px; }
  .task-main h3 { line-height: 1.45; }
  .task-actions { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .task-actions .button { min-height: 32px; }
  .activity-section { padding-top: 2px; }
  .filter-bar { padding: 10px; }
  .team-list { grid-template-columns: 1fr; }
  .integration-metric { min-height: 94px; padding: 15px; }
  .integration-metric strong { font-size: 17px; }
  .status-dot { top: 15px; right: 15px; }
  .config-line { grid-template-columns: 1fr; gap: 5px; padding: 11px 0; align-content: center; }
  .department-role-panel { padding: 15px; }
  .department-role-row { padding: 12px 0; grid-template-columns: minmax(0, 1fr) 1fr; }
  .department-role-row .button { grid-column: 1 / 3; }
  .modal { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 8px 8px 0 0; }
  .modal::backdrop { backdrop-filter: none; }
  .modal-head { min-height: 66px; padding: 14px 16px; }
  .modal-body { padding: 17px 16px; }
  .modal-actions { min-height: 64px; padding: 11px 16px calc(11px + env(safe-area-inset-bottom)); }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-grid .span-2 { grid-column: 1; }
  .detail-summary, .detail-history { padding: 17px 16px; }
  .detail-title-row h2 { font-size: 17px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .toast-region { left: 15px; right: 15px; bottom: 82px; }
  .toast { width: 100%; }
}

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