/* ============================================
   FINAL DOMAINE GROUPWARE MASTER — App Shell
   Built on PECO design tokens
   ============================================ */

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
html, body, #root { width: 100%; overflow-x: hidden; }
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --mobile-ui-zoom: .5;
}
html[data-mobile-ui-size="zoom50"],
html[data-mobile-ui-size="scale100"] { --mobile-ui-zoom: .5; }
html[data-mobile-ui-size="zoom75"],
html[data-mobile-ui-size="scale125"],
html[data-mobile-ui-size="scale150"] { --mobile-ui-zoom: .75; }
html[data-mobile-ui-size="zoom100"],
html[data-mobile-ui-size="scale200"] { --mobile-ui-zoom: 1; }
html[data-mobile-ui-size="zoom125"] { --mobile-ui-zoom: 1.25; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; white-space: nowrap; }
.btn, .btn-create, .fab__btn, .tab span, .date-range button, .org-switcher, .org-switcher span, .user-chip .who, .user-chip .role, .tabs__crumbs span, .nav-item .label { white-space: nowrap; }
.tabs__crumbs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-header__title h1 { white-space: nowrap; }
.page-header__title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__head h3 { white-space: nowrap; min-width: 0; flex-shrink: 0; }
.table-wrap { overflow-x: auto; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================
   APP SHELL
   ============================================ */
.app {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar workspace context";
  height: 100vh;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
/* 좌측 패널(사이드바) 완전 숨김 — 웹앱 하단바 토글. 사이드바 컬럼(모바일 고정 60px)을 0 으로 접어 워크스페이스가 좌측까지 확장됨. */
.app.app--no-sidebar .sidebar { display: none; }
.app.app--no-sidebar { grid-template-columns: 0 minmax(0, 1fr) !important; }
.app.app--storage-open {
  grid-template-columns: auto 272px minmax(0, 1fr) auto;
  grid-template-areas:
    "topbar topbar topbar topbar"
    "sidebar storage-panel workspace context";
}

@supports (height: 100dvh) {
  .app { height: 100dvh; }
}

@media (display-mode: standalone) {
  .app {
    grid-template-rows: calc(56px + var(--safe-top)) 1fr;
    padding-right: var(--safe-right);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
  }
  .topbar {
    padding-top: var(--safe-top);
  }
}

.topbar { grid-area: topbar; }
.sidebar { grid-area: sidebar; }
.storage-panel { grid-area: storage-panel; min-width: 0; }
.workspace { grid-area: workspace; min-width: 0; max-width: 100%; }
.context { grid-area: context; min-width: 0; }

/* ============================================
   TOP BAR
   ============================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 0;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  min-width: 0;
  overflow-x: hidden;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 248px;
  padding: 0 18px;
  height: 100%;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar__brand img {
  max-width: 100%;
  object-fit: contain;
}
.topbar__brand .mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
}
.topbar__brand .wordmark {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.topbar__brand .wordmark small {
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-top: 2px;
}

.org-switcher {
  display: flex; align-items: center; gap: 8px;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--fg);
  font-weight: 500;
}
.org-switcher .org-mono {
  width: 20px; height: 20px;
  border-radius: 5px;
  background: var(--fg);
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
}
.org-switcher .chev { color: var(--fg-3); }

.topbar__search {
  flex: 1;
  min-width: 0;
  max-width: none;
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 4px 0 12px;
  transition: all 120ms var(--ease-out);
}
.topbar__search:focus-within {
  background: var(--bg-elev);
  border-color: var(--fg);
  box-shadow: 0 0 0 3px var(--bg-inset);
}
.topbar__search .icon { color: var(--fg-3); flex-shrink: 0; }
.topbar__search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  outline: 0;
  height: 100%;
  font-size: 13px;
  color: var(--fg);
  padding: 0 8px;
}
.topbar__search input::placeholder { color: var(--fg-4); }
.topbar__search .ai-pill {
  display: flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--fg);
  color: var(--accent-fg);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar__search .kbd {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--fg-3);
  margin-right: 6px;
}

.topbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--fg-2);
  transition: all 120ms var(--ease-out);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--fg); }
.icon-btn .dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--bg-elev);
}
.icon-btn .badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  display: grid; place-items: center;
  padding: 0 4px;
  border: 1.5px solid var(--bg-elev);
}

.btn-create {
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 10px 0 12px;
  background: var(--fg);
  color: var(--accent-fg);
  border: 0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 120ms var(--ease-out);
}
.btn-create:hover { background: var(--accent-hover); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 120ms var(--ease-out);
}
.user-chip:hover { border-color: var(--border); background: var(--bg-sunken); }
.user-chip > div { min-width: 0; max-width: 168px; }
.user-chip .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--fg);
  font-weight: 700;
  font-size: 11px;
  display: grid; place-items: center;
}
.user-chip .who { font-size: 12px; font-weight: 600; color: var(--fg); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { font-size: 10.5px; color: var(--fg-3); line-height: 1.2; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: 248px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 180ms var(--ease-out);
}
.sidebar.collapsed { width: 60px; }
.sidebar__scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 8px 8px; }

.nav-section { margin-bottom: 14px; }
.nav-section__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-4);
  padding: 6px 12px 6px;
}
/* 접힘 상태: 섹션 라벨의 세로 공간을 펼침과 동일하게 예약(텍스트만 숨김, 첫 WORKSPACE 포함) → 펼칠 때 아이콘이 제자리에 정렬. */
.sidebar.collapsed .nav-section__label {
  display: block;
  visibility: hidden;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
  position: relative;
  text-decoration: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-sunken); color: var(--fg); }
.nav-item--center { color: var(--fg-4); }
.nav-item--center:hover { color: var(--fg-3); }
.nav-item.active {
  background: var(--fg);
  color: var(--accent-fg);
}
.nav-item.active .nav-count { background: rgba(255,255,255,0.18); color: white; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  font-size: 10.5px;
  font-weight: 700;
  background: var(--bg-inset);
  color: var(--fg-2);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}
.nav-count.danger { background: var(--danger); color: white; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; width: 44px; height: 40px; margin: 0 auto; }
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .nav-count,
.sidebar.collapsed .nav-item .chev { display: none; }

.nav-group__head { display: flex; align-items: center; }
.nav-group__head .chev { color: var(--fg-4); margin-left: 4px; transition: transform 180ms; }
.nav-group.open .nav-group__head .chev { transform: rotate(90deg); }
.nav-group__children { padding: 2px 0 4px 22px; display: none; border-left: 1px solid var(--border-muted); margin-left: 19px; }
.nav-group.open .nav-group__children { display: block; }
.nav-group__children .nav-item { font-size: 12.5px; height: 30px; color: var(--fg-3); }
.nav-group__children .nav-item:hover { color: var(--fg); }
.nav-group__children .nav-item.active { background: var(--bg-sunken); color: var(--fg); }

.sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar__mobile-footer,
.sidebar__mobile-close { display: none; }
.collapse-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg-3);
}
.collapse-btn:hover { color: var(--fg); border-color: var(--border-strong); }

.storage-panel {
  display: flex;
  flex-direction: column;
  width: 272px;
  min-width: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.storage-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.storage-panel__head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-transform: uppercase;
}
.storage-panel__head span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--fg-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.storage-panel__centers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.storage-panel__centers button {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg-2);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.storage-panel__centers button.active {
  background: var(--fg);
  color: var(--accent-fg);
  border-color: var(--fg);
}
.storage-panel__meta {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 2px;
}
.storage-panel__meta b {
  font-size: 12px;
  color: var(--fg);
}
.storage-panel__meta span,
.storage-panel__meta small {
  font-size: 10.5px;
  color: var(--fg-3);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.storage-panel__crumbs {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.storage-panel__crumbs::-webkit-scrollbar { display: none; }
.storage-panel__crumbs button {
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.storage-panel__list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}
.storage-entry {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  text-align: left;
}
.storage-entry:hover {
  background: var(--bg-sunken);
  color: var(--fg);
}
.storage-entry--directory .icon { color: #1f4d8f; }
.storage-entry--file .icon { color: #047857; }
.storage-entry__name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 600;
}
.storage-entry__meta {
  color: var(--fg-4);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.storage-entry--up {
  grid-template-columns: 18px minmax(0, 1fr);
  color: var(--fg);
  font-weight: 700;
}
.storage-panel__empty {
  padding: 14px 8px;
  color: var(--fg-4);
  font-size: 11px;
  text-align: center;
}
.storage-panel__empty--error {
  color: var(--danger);
}
.storage-preview {
  flex: 0 0 34%;
  min-height: 140px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.storage-preview__head {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid var(--border);
}
.storage-preview__head b {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--fg);
}
.storage-preview pre {
  margin: 0;
  padding: 9px 10px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--fg-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.storage-window-page,
.finalalarm-page {
  width: 100%;
  max-width: none;
}
.file-window {
  display: grid;
  grid-template-columns: 220px minmax(320px, 1fr) minmax(300px, 38%);
  min-height: min(720px, calc(100vh - 190px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  overflow: hidden;
}
.file-window__nav {
  border-right: 1px solid var(--border);
  background: var(--bg);
  min-width: 0;
  padding: 12px;
}
.file-window__nav-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.file-window__centers {
  display: grid;
  gap: 6px;
}
.file-window__centers button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--fg-2);
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.file-window__centers button span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.file-window__centers button.active {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--accent-fg);
}
.file-window__summary {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.file-window__summary b {
  font-size: 13px;
  color: var(--fg);
}
.file-window__summary span,
.file-window__summary small {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: var(--fg-3);
}
.file-window__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.file-window__toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.file-window__toolbar > span {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}
.file-window__crumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.file-window__crumbs::-webkit-scrollbar {
  display: none;
}
.file-window__crumbs button {
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.file-window__list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}
.file-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-2);
  text-align: left;
  cursor: pointer;
}
.file-row:hover,
.file-row.active {
  background: var(--bg-sunken);
  border-color: var(--border);
  color: var(--fg);
}
.file-row span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12.5px;
  font-weight: 600;
}
.file-row small {
  color: var(--fg-4);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.file-row--up {
  color: var(--fg);
  font-weight: 700;
}
.file-window__preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.file-window__preview-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
}
.file-window__preview-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.file-window__preview-head b,
.file-window__preview-head span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.file-window__preview-head b {
  font-size: 12.5px;
  color: var(--fg);
}
.file-window__preview-head span {
  font-size: 10.5px;
  color: var(--fg-4);
}
.file-window__preview-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
}
.file-window__text {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--fg-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.file-window__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
}
.file-window__frame {
  flex: 1;
  width: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}
.file-window__empty {
  flex: 1;
  min-height: 140px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--fg-4);
  font-size: 12px;
}
.file-window__empty--error {
  color: var(--danger);
}
.finalalarm-hours {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elev);
}
.finalalarm-hours button {
  min-width: 42px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.finalalarm-hours button.active {
  background: var(--fg);
  color: var(--accent-fg);
}
.finalalarm-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.finalalarm-stat {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  padding: 12px 14px;
}
.finalalarm-stat span {
  font-size: 11px;
  color: var(--fg-3);
}
.finalalarm-stat b {
  font-size: 24px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.finalalarm-stat--danger { border-left: 4px solid var(--danger); }
.finalalarm-stat--warning { border-left: 4px solid #b7791f; }
.finalalarm-stat--success { border-left: 4px solid #047857; }
.finalalarm-stat--info { border-left: 4px solid #1f4d8f; }
.finalalarm-shell {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elev);
}
.finalalarm-source {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.finalalarm-source span,
.finalalarm-source small {
  color: var(--fg-4);
  font-size: 11px;
}
.finalalarm-source b {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--fg-2);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.finalalarm-list {
  max-height: min(680px, calc(100vh - 310px));
  overflow: auto;
}
.finalalarm-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-muted);
}
.finalalarm-row:last-child {
  border-bottom: 0;
}
.finalalarm-row__time {
  color: var(--fg-4);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.finalalarm-row__body {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.finalalarm-row__body div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.finalalarm-row__body b {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--fg);
}
.finalalarm-row__body span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 10.5px;
  color: var(--fg-4);
}
.finalalarm-row__body p {
  margin: 0;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.finalalarm-row__badges {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}
.finalalarm-row__badges span {
  min-width: 42px;
  text-align: center;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg-3);
  font-size: 10.5px;
  font-weight: 700;
}
.finalalarm-row--danger .finalalarm-row__badges span:first-child {
  color: var(--danger);
  border-color: #e9a39e;
}
.finalalarm-row--warning .finalalarm-row__badges span:first-child {
  color: #9a5b05;
  border-color: #e8c17f;
}
.finalalarm-row--success .finalalarm-row__badges span:first-child {
  color: #047857;
  border-color: #8bc7ad;
}
.finalalarm-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--fg-4);
  font-size: 12px;
  text-align: center;
}
.finalalarm-empty--error {
  color: var(--danger);
}

/* ============================================
   WORKSPACE
   ============================================ */
.workspace {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* Workspace tabs */
.tabs {
  display: flex;
  align-items: center;
  height: 38px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  max-width: 100%;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 8px;
  height: 30px;
  padding: 0 10px 0 12px;
  border-radius: 7px 7px 0 0;
  font-size: 12.5px;
  color: var(--fg-3);
  background: transparent;
  border: 0;
  position: relative;
  flex-shrink: 0;
  font-weight: 500;
  border: 1px solid transparent;
  border-bottom: 0;
}
.tab .icon { width: 14px; height: 14px; flex-shrink: 0; }
.tab .x {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 4px;
  color: var(--fg-4);
}
.tab .x:hover { background: var(--bg-inset); color: var(--fg); }
.tab__close:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
}
.tab:hover { color: var(--fg-2); background: var(--bg-sunken); }
.tab.active {
  background: var(--bg-elev);
  color: var(--fg);
  border-color: var(--border);
  border-bottom-color: var(--bg-elev);
  margin-bottom: -1px;
  z-index: 2;
}
.tab .dirty {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--info);
}
.tabs__add {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--fg-3); border: 0; background: transparent;
}
.tabs__add:hover { background: var(--bg-sunken); color: var(--fg); }
.tabs__spacer { flex: 1; }
.tabs__crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  color: var(--fg-3);
  padding: 0 8px;
}
.tabs__crumbs span { color: var(--fg-4); }

/* Main scrollable region */
.workspace__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
}
.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(16px, 1.2vw, 24px) clamp(14px, 1.35vw, 28px) 80px;
}
.page.center-page--finance-v2 {
  max-width: none;
  padding: 0;
}
/* 재무 운영 센터 코쿠핏 — 레일/본문을 워크스페이스 스크롤포트 높이에 정확히 맞춘다.
   (기존 100vh 는 상단바+탭바(약 94px)만큼 화면 밖으로 넘쳐 레일 하단 메뉴가 잘리고,
   레일이 본문과 함께 스크롤돼 sticky 가 동작하지 않았음) */
.page.center-page--finance-v2:has(> .bp2-finance-shell) {
  height: 100%;
  min-height: 0;
}
.bp2-finance-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: stretch;
  height: 100%;
  min-height: 0;
  background: #fff;
}
.bp2-finance-rail {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 16px;
  border-right: 1px solid var(--border);
  background: #f6f6f6;
  scrollbar-width: thin;
}
.bp2-finance-rail__identity { padding: 1px 4px 0; }
.bp2-finance-rail__title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 800;
}
.bp2-finance-rail__sub {
  margin-top: 4px;
  color: var(--fg-3);
  font-size: 11.5px;
}
.bp2-finance-nav {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.bp2-finance-nav__group { display: grid; gap: 4px; }
.bp2-finance-nav__label {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 2px;
  color: #8b95a5;
  font-size: 10.5px;
  font-weight: 800;
}
.bp2-finance-nav__items { display: grid; gap: 4px; }
.bp2-finance-nav__button {
  display: flex;
  align-items: center;
  min-height: 29px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.bp2-finance-nav__button:hover {
  border-color: rgba(16, 20, 24, .18);
  background: #fafafa;
}
.bp2-finance-nav__button.is-active,
.bp2-finance-nav__button.is-active:hover {
  border-color: transparent;
  background: #e9eaec;
  color: #111418;
}
.bp2-finance-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 80px;
  background: #fff;
  scrollbar-gutter: stable;
}
/* 모듈이 자체 제목을 그리므로 셸 제목은 위치 표시(eyebrow) 수준으로 낮춘다 */
.bp2-finance-header { margin-bottom: 12px; }
.bp2-finance-header h2 {
  margin: 0;
  color: var(--fg-3);
  font-size: 13.5px;
  font-weight: 760;
}
.bp2-finance-header p {
  margin: 5px 0 0;
  color: var(--fg-3);
  font-size: 12px;
}
.bp2-finance-body { min-width: 0; }
.bp2-finance-body > .page { padding: 0; }

/* ── 재무 운영 센터 세로 리듬 정규화 ─────────────────────────────
   35개 화면의 최상위 섹션 간격이 0/4/6/7/8/9/10/11/12/14/17/18/22/24/31px 로
   제각각이었음(모듈별 인라인 마진 + finance-v2 화면별 gap 오버라이드).
   → [셸 헤더 → 본문 12px] + [섹션 사이 14px] 한 가지 리듬으로 통일한다.
   자체 리듬이 이미 일관된 대시보드(.chv2)와 프로세스 허브(section)는 제외. */

/* (1) 일반 모듈 — GL·AR·AP·AA·CO·FS·TR·Tax·Close·전표·은행원장·운영내역서·자료정리·품의·실행업무 */
.bp2-finance-body > div:not(.chv2):not(.bp2v2) {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 0 !important;
}
.bp2-finance-body > div:not(.chv2):not(.bp2v2) > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* (2) finance-v2 임베드 계열 — 카드/매출/매입 내역, 세금계산서, 현금영수증, 자금현황,
   거래처, 정산, 이체, 거래 분류, 맞춤 분석, 매출 대시보드 (화면별 gap 오버라이드를 덮어씀) */
.bp2-finance-main .bp2-finance-body .bp2v2-app {
  gap: 14px;
  padding-top: 0;
}
/* 화면별 오프셋 하드코딩(margin-top 17/18/360px 등)이 컨테이너 gap 위에 덧붙어
   같은 페이지 안에서 14px 와 31/32/374px 가 섞이던 문제 — 간격은 gap 이 단독으로 책임진다 */
.bp2-finance-main .bp2-finance-body .bp2v2-app > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
.bp2-process-hub { min-width: 0; }
.bp2-process-hub__bar {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 44px;
  margin-bottom: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.bp2-process-hub__cadence {
  display: inline-flex;
  flex: 0 0 64px;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}
.bp2-process-hub__steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.bp2-process-hub__step {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 112px;
  min-height: 43px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid #eef0f2;
  background: #fff;
  color: #667085;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
}
.bp2-process-hub__step:hover { background: #f7f8f9; color: #1d2939; }
.bp2-process-hub__step > span {
  display: inline-flex;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d0d5dd;
  border-radius: 50%;
  color: #667085;
  font-size: 10px;
  font-weight: 800;
}
.bp2-process-hub__step > b { font-weight: 750; }
.bp2-process-hub__step.is-active {
  background: #f2f4f7;
  color: #101828;
}
.bp2-process-hub__step.is-active > span {
  border-color: #101828;
  background: #101828;
  color: #fff;
}
.bp2-process-hub__body { min-width: 0; }
.bp2-process-hub__body > .page { padding: 0; }

@media (min-width: 1101px) {
  .bp2-process-hub__steps {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
  }
  .bp2-process-hub__step {
    flex: 1 1 118px;
  }
}

@media (max-height: 820px) and (min-width: 1101px) {
  .bp2-finance-rail { padding: 8px 10px 12px; }
  .bp2-finance-rail__identity { display: none; }
  .bp2-finance-nav { gap: 6px; margin-top: 0; }
  .bp2-finance-nav__group { gap: 2px; }
  .bp2-finance-nav__label { height: 18px; font-size: 10px; }
  .bp2-finance-nav__items { gap: 2px; }
  .bp2-finance-nav__button { min-height: 24px; font-size: 11.5px; }
}

@media (max-width: 1100px) {
  /* 태블릿·모바일: 레일이 상단 가로 스크롤 바로 바뀌므로 페이지 전체 스크롤로 되돌린다 */
  .page.center-page--finance-v2:has(> .bp2-finance-shell) { height: auto; }
  .bp2-finance-shell {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    height: auto;
    min-height: 0;
  }
  .bp2-finance-rail {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: #fff;
    scrollbar-width: thin;
  }
  .bp2-finance-rail__identity,
  .bp2-finance-nav__label { display: none; }
  .bp2-finance-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    min-width: 100%;
    margin: 0;
  }
  .bp2-finance-nav__group { display: block; }
  .bp2-finance-nav__items { display: flex; gap: 6px; }
  .bp2-finance-nav__button {
    min-height: 34px;
    padding: 0 11px;
    border-color: #e5e7eb;
    background: #fff;
    white-space: nowrap;
  }
  .bp2-finance-nav__button.is-active,
  .bp2-finance-nav__button.is-active:hover {
    border-color: #111418;
    background: #111418;
    color: #fff;
  }
  .bp2-finance-main {
    height: auto;
    overflow: visible;
    padding: 12px 12px 64px;
    scrollbar-gutter: auto;
  }
  .bp2-process-hub__bar { margin: 0 -2px 12px; }
  .bp2-process-hub__cadence { display: none; }
  .bp2-process-hub__steps { grid-auto-columns: minmax(116px, max-content); }
}
.page > *,
.table-wrap {
  max-width: 100%;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 24px;
}
.page-header__title h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--fg);
}
.page-header__title .sub {
  font-size: 13px;
  color: var(--fg-3);
  display: flex; align-items: center; gap: 8px;
}
.page-header__title .sub b { color: var(--fg); font-weight: 600; }
.page-header__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 8px; }

/* 결재함 목록: 제목 좌측 + 요약(총·대기·승인·반려) 우측 유지(모바일/터치 포함). */
[data-screen-label="Approval Center"] .page-header {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;   /* 카드 간격(14px)과 통일 */
}
[data-screen-label="Approval Center"] .page-header__title { flex: 0 0 auto; }
[data-screen-label="Approval Center"] .page-header__actions {
  width: auto;
  flex: 0 1 auto;
  justify-content: flex-end;
}

/* 결재/지출 편집기: 제목 한 줄, 그 아래 기능 버튼 한 줄(좁으면만 줄바꿈). 해상도·포인터 무관. */
[data-screen-label="Approval Form"] .page-header {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;             /* 제목↔기능박스 = 카드 간격(14px)과 통일 */
  margin-bottom: 14px;
}
[data-screen-label="Approval Form"] .page-header__title { flex: 0 0 auto; }
[data-screen-label="Approval Form"] .page-header__actions {
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;   /* 균일 간격 + 스페이서로 우측 밀기(결재함과 동일 패턴) */
  column-gap: 6px;
  row-gap: 6px;
  /* 제목/문서일자(메타 카드)처럼 박스 안에 담기 */
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  box-sizing: border-box;
}
[data-screen-label="Approval Form"] .apv-tb-div {   /* 결재함과 동일한 세로 구분선 */
  align-self: stretch;
  width: 1px;
  background: var(--border-muted);
  margin: 0 2px;
}
[data-screen-label="Approval Form"] .apv-tb-spacer { flex: 1 1 auto; min-width: 8px; }
[data-screen-label="Approval Form"] .page-header__actions > .btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 1180px), (pointer: coarse), (display-mode: standalone) {
  .app {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace";
  }
  .app.app--storage-open {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace";
  }
  .storage-panel { display: none; }
  .file-window {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .file-window__nav,
  .file-window__main {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .file-window__centers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .file-window__preview {
    min-height: 360px;
  }
  .finalalarm-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .finalalarm-source {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
  .finalalarm-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }
  .finalalarm-row__badges {
    justify-content: flex-start;
  }
  .context { display: none; }
  .sidebar { width: 60px; }
  .sidebar .nav-item .label,
  .sidebar .nav-item .nav-count,
  .sidebar .nav-item .chev { display: none; }
  /* 접힘에서도 섹션 라벨의 세로 공간은 예약(텍스트만 숨김) → 펼칠 때 메뉴가 위아래로 안 밀리고 아이콘이 제자리. */
  .sidebar .nav-section__label { visibility: hidden; white-space: nowrap; overflow: hidden; }
  /* 접힘 상태도 펼침과 동일하게 좌측정렬·동일 높이 → 펼칠 때 아이콘이 제자리에 고정(중앙→좌측 점프 제거). */
  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 0 12px;
    width: 100%;
    height: 40px;
    margin: 0;
  }
  .sidebar.sidebar--compact {
    position: relative;
    z-index: 45;
    min-height: 0;
    height: 100%;
    overflow: visible;
  }
  .sidebar.sidebar--compact .sidebar__scroll {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 8px;
  }
  .sidebar.sidebar--compact .sidebar__footer {
    display: none;
  }
  .sidebar.sidebar--compact .sidebar__mobile-footer {
    position: relative;
    left: auto;
    bottom: auto;
    flex: 0 0 auto;
    z-index: 4;
    display: flex;
    width: 60px;
    box-sizing: border-box;
    padding: 8px 8px calc(22px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg-elev);
  }
  .sidebar.sidebar--compact.sidebar--mobile-open {
    width: 60px;
    z-index: 70;
    box-shadow: none;
  }
  .sidebar.sidebar--compact .nav-item {
    transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out), border-color 120ms var(--ease-out);
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .sidebar__scroll {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    width: min(286px, calc((100vw / var(--mobile-ui-zoom)) - 44px));
    height: auto;
    box-sizing: border-box;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    box-shadow: 14px 0 34px rgba(16, 24, 40, 0.18);
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .sidebar__mobile-footer {
    width: min(286px, calc((100vw / var(--mobile-ui-zoom)) - 44px));
    box-shadow: 14px 0 34px rgba(16, 24, 40, 0.18);
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-section__label,
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-item .label,
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-item .nav-count,
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-item .chev {
    display: flex;
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-section__label {
    display: block;
    visibility: visible;
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-item {
    justify-content: flex-start;
    padding: 0 12px;
    width: 100%;
    height: 40px;
    margin: 0;
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .sidebar__mobile-close {
    position: relative;
    left: auto;
    bottom: auto;
    flex: 0 0 auto;
    z-index: 4;
    display: flex;
    width: min(286px, calc((100vw / var(--mobile-ui-zoom)) - 44px));
    box-sizing: border-box;
    margin: 0;
    padding: 8px 8px calc(22px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg-elev);
    box-shadow: 14px 0 34px rgba(16, 24, 40, 0.18);
  }
  .sidebar.sidebar--compact .nav-item.nav-item--sidebar-toggle {
    height: 48px;
    margin-top: 8px !important;
    border: 1px solid var(--border);
    background: var(--bg-sunken);
    color: var(--fg);
  }
  .sidebar.sidebar--compact.sidebar--mobile-open .nav-item.nav-item--sidebar-toggle {
    height: 40px;
  }
  .sidebar.sidebar--compact .sidebar__mobile-footer .nav-item.nav-item--sidebar-toggle {
    margin: 0 !important;
  }
  .sidebar.sidebar--compact .sidebar__mobile-close .nav-item.nav-item--sidebar-toggle {
    margin: 0 !important;
  }
  .topbar { gap: 8px; padding-right: 8px; }
  .topbar__brand { width: 60px; padding: 0 10px; }
  .topbar__brand img { max-width: 40px; }
  .org-switcher .muted,
  .topbar__search .ai-pill,
  .topbar__search .kbd,
  .user-chip .role { display: none; }
  .tabs .tab .tab__close {
    order: -1;
    margin-left: 0 !important;
    margin-right: 6px;
  }
  .tabs__crumbs { display: none; }
}

@media (max-width: 760px) {
  .topbar__search { max-width: none; min-width: 0; }
  .topbar__actions { flex: 0 0 auto; min-width: 0; }
  .topbar-action--refresh,
  .topbar-action--mail,
  .topbar-action--video,
  .topbar-action-divider { display: none; }
  .org-switcher { display: none; }
  .btn-create { width: 32px; padding: 0; justify-content: center; }
  .btn-create span { display: none; }
  .user-chip { padding: 4px; }
  .user-chip > div,
  .user-chip .icon { display: none; }
  .page { padding: 18px 14px 72px; }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .page-header__actions {
    width: 100%;
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 2px;
  }
  .page[data-screen-label="Documents"] .grid-12 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .page[data-screen-label="Documents"] .grid-12 > .col-3,
  .page[data-screen-label="Documents"] .grid-12 > .col-4,
  .page[data-screen-label="Documents"] .grid-12 > .col-6 {
    grid-column: span 1;
    min-width: 0;
  }
}

/* BUSINESS PROCESS: source-backed, one-page center home. */
.center-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  color: var(--fg);
}
.center-home button {
  color: inherit;
}
.center-home__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 0 2px 8px;
  border-bottom: 1px solid var(--border);
}
.center-home__bar-copy,
.center-home__bar-actions,
.center-home__sources,
.center-home__section-head,
.center-home__flow-track {
  display: flex;
  align-items: center;
}
.center-home__bar-copy {
  min-width: 0;
  gap: 8px;
}
.center-home__bar-copy > strong {
  flex: 0 0 auto;
  font-size: 13px;
}
.center-home__bar-copy > span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--fg-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #16724a;
  font-size: 9px;
  font-weight: 800;
}
.center-home__live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1aa36f;
}
.center-home__bar-actions {
  flex: 0 0 auto;
  gap: 8px;
  color: var(--fg-3);
  font-size: 10.5px;
}
.center-home__bar-actions .icon-btn {
  width: 28px;
  height: 28px;
}
.center-home__source-total {
  color: var(--fg-2);
  font-weight: 700;
}
.center-home__sources {
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.center-home__sources > span {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border-muted);
  border-radius: 5px;
  background: var(--bg-elev);
  color: var(--fg-3);
  font-size: 10.5px;
}
.center-home__sources b {
  color: var(--fg);
}
.center-home__sources em {
  color: #9a6700;
  font-size: 8.5px;
  font-style: normal;
  font-weight: 800;
}
.center-home__sources > span.is-reference {
  border-style: dashed;
  background: #fffaf0;
}
.center-home__sources > span.is-imported {
  border-style: dashed;
  background: #f8fafc;
}
.center-home__sources > span.is-derived,
.center-home__sources > span.is-mixed {
  background: #f6f8fa;
}
.center-home__sources > span.is-derived em,
.center-home__sources > span.is-mixed em {
  color: #475467;
}
.center-home__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
}
.center-home__metric {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: start;
  min-width: 0;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  text-align: left;
}
button.center-home__metric {
  width: 100%;
  font: inherit;
}
.center-home__metric.is-clickable:hover,
.center-home__stage.is-clickable:hover,
.center-home__list-row.is-clickable:hover,
.center-home__recent-row.is-clickable:hover {
  border-color: var(--border-strong);
  background: var(--bg-sunken);
}
.center-home__metric-label,
.center-home__metric-sub {
  overflow: hidden;
  color: var(--fg-3);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__metric > strong {
  align-self: center;
  overflow: hidden;
  color: var(--fg);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__metric.is-good > strong { color: #16724a; }
.center-home__metric.is-danger > strong { color: #b42318; }
.center-home__metric > svg {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: var(--fg-4);
}
.center-home__flow,
.center-home__panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
}
.center-home__flow {
  padding: 10px 12px 12px;
}
.center-home__section-head {
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}
.center-home__section-head > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.center-home__section-head h3 {
  margin: 0;
  font-size: 12.5px;
}
.center-home__eyebrow {
  color: var(--fg-4);
  font-size: 8.5px;
  font-weight: 800;
}
.center-home__muted {
  color: var(--fg-4);
  font-size: 10px;
}
.center-home__flow-track {
  justify-content: stretch;
  gap: 5px;
  margin-top: 6px;
  overflow: hidden;
}
.center-home__flow-track > svg {
  flex: 0 0 auto;
  color: var(--fg-4);
}
.center-home__stage {
  display: grid;
  flex: 1 1 0;
  gap: 2px;
  min-width: 58px;
  height: 42px;
  padding: 5px 8px;
  border: 1px solid var(--border-muted);
  border-radius: 5px;
  background: var(--bg);
  text-align: center;
}
button.center-home__stage {
  font: inherit;
}
.center-home__stage strong {
  font-size: 14px;
  line-height: 1;
}
.center-home__stage span {
  overflow: hidden;
  color: var(--fg-3);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}
.center-home__lower.is-single {
  grid-template-columns: minmax(0, 1fr);
}
.center-home__panel {
  overflow: hidden;
  padding: 10px 12px 4px;
}
.center-home__panel-count {
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #fff1ef;
  color: #b42318;
  font-size: 10px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}
.center-home__list {
  min-width: 0;
}
.center-home__list-row,
.center-home__recent-row {
  display: grid;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 6px 2px;
  border: 0;
  border-top: 1px solid var(--border-muted);
  background: transparent;
  text-align: left;
}
.center-home__list-row {
  grid-template-columns: 7px minmax(0, 1fr) auto auto;
  gap: 8px;
}
.center-home__signal {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d99000;
}
.center-home__list-row.is-danger .center-home__signal { background: #d92d20; }
.center-home__list-row > b {
  color: var(--fg);
  font-size: 12px;
}
.center-home__list-copy,
.center-home__recent-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.center-home__list-copy strong,
.center-home__recent-copy strong {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__list-copy small,
.center-home__recent-copy small {
  overflow: hidden;
  color: var(--fg-3);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.center-home__recent-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}
.center-home__recent-row time {
  color: var(--fg-4);
  font-size: 9px;
  white-space: nowrap;
}
.center-home--message {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
}
.center-home--message strong { font-size: 13px; }
.center-home--message p {
  margin: 4px 0 0;
  color: var(--fg-3);
  font-size: 11.5px;
}
.center-home--loading {
  gap: 10px;
}
.center-home__loading-line,
.center-home__loading-grid i {
  display: block;
  border-radius: 5px;
  background: var(--bg-sunken);
}
.center-home__loading-line { width: 38%; height: 30px; }
.center-home__loading-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.center-home__loading-grid i { height: 74px; }

@media (min-width: 768px) and (max-width: 1366px) {
  .page.center-page:not(.center-page--finance-v2):has(.center-home) {
    padding-bottom: 16px;
  }
  .center-cockpit:has(.center-home) .center-cockpit__header {
    flex-wrap: nowrap !important;
    align-items: center !important;
    min-height: 28px;
    margin-bottom: 6px !important;
  }
  .center-cockpit:has(.center-home) .center-cockpit__header h2 {
    font-size: 18px !important;
  }
  .center-cockpit:has(.center-home) .center-cockpit__header p,
  .center-cockpit:has(.center-home) .center-cockpit__header > div:nth-child(n + 2) {
    display: none !important;
  }
  .center-cockpit:has(.center-home) .center-cockpit__tabs {
    flex-wrap: nowrap !important;
    width: 100%;
    max-width: 100%;
    margin-bottom: 4px !important;
    padding-bottom: 6px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .center-cockpit:has(.center-home) .center-cockpit__tabs::-webkit-scrollbar {
    display: none;
  }
  .center-cockpit:has(.center-home) .center-cockpit__tabs > button {
    flex: 0 0 auto;
  }
  .center-cockpit:has(.center-home) :is(
    [data-testid="sales-qa-bar"] > div:first-child,
    [data-testid="pops-quickbar"],
    [data-testid="legal-quickbar"] > .card__body,
    [data-qa="quick-actions"],
    [data-qa="lg-quickbar"],
    [data-qa="human-action-bar"]
  ) {
    flex-wrap: nowrap !important;
    width: 100%;
    max-width: 100%;
    min-height: 40px;
    margin-bottom: 6px !important;
    padding: 6px 8px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .center-cockpit:has(.center-home) :is(
    [data-testid="sales-qa-bar"] > div:first-child,
    [data-testid="pops-quickbar"],
    [data-testid="legal-quickbar"] > .card__body,
    [data-qa="quick-actions"],
    [data-qa="lg-quickbar"],
    [data-qa="human-action-bar"]
  )::-webkit-scrollbar {
    display: none;
  }
  .center-cockpit:has(.center-home) :is(
    [data-testid="sales-qa-bar"] > div:first-child,
    [data-testid="pops-quickbar"],
    [data-testid="legal-quickbar"] > .card__body,
    [data-qa="quick-actions"],
    [data-qa="lg-quickbar"],
    [data-qa="human-action-bar"]
  ) > * {
    flex: 0 0 auto !important;
    white-space: nowrap;
  }
  .center-cockpit:has(.center-home) [data-testid="legal-quickbar"] {
    margin-bottom: 6px !important;
    overflow: hidden;
  }
  .center-cockpit:has(.center-home) [data-qa="hr-quick-bar"] > div:first-child {
    margin-bottom: 6px !important;
    padding: 6px 8px !important;
  }
  .center-cockpit:has(.center-home) [data-qa="hr-quick-bar"] > div:first-child > div:first-child {
    flex-wrap: nowrap !important;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .center-cockpit:has(.center-home) [data-qa="hr-quick-bar"] > div:first-child > div:first-child::-webkit-scrollbar {
    display: none;
  }
  .center-cockpit:has(.center-home) [data-qa="hr-quick-bar"] > div:first-child > div:nth-child(n + 2) {
    display: none !important;
  }
  .center-home {
    gap: 8px;
  }
  .center-home__metric {
    min-height: 68px;
    padding: 8px 10px;
  }
  .center-home__metric > strong {
    font-size: 16px;
  }
  .center-home__list > :nth-child(n + 4) {
    display: none;
  }
}

@media (max-width: 767px) {
  .center-home__bar {
    align-items: flex-start;
  }
  .center-home__bar-copy > span:last-child,
  .center-home__bar-actions > time {
    display: none;
  }
  .center-home__sources {
    overflow-x: auto;
  }
  .center-home__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .center-home__flow-track {
    overflow-x: auto;
  }
  .center-home__stage {
    flex: 0 0 82px;
  }
  .center-home__lower {
    grid-template-columns: minmax(0, 1fr);
  }
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  transition: all 120ms var(--ease-out);
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-sunken); }
.btn.primary { background: var(--fg); color: var(--accent-fg); border-color: var(--fg); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--bg-sunken); color: var(--fg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon-only { width: 32px; padding: 0; justify-content: center; }

/* Date range */
.date-range {
  display: flex; align-items: center; gap: 0;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  font-size: 12.5px;
  overflow: hidden;
}
.date-range button {
  height: 100%;
  padding: 0 12px;
  border: 0; background: transparent;
  color: var(--fg-3);
  font-weight: 500;
  border-right: 1px solid var(--border);
}
.date-range button:last-child { border-right: 0; }
.date-range button.active { background: var(--bg-sunken); color: var(--fg); font-weight: 600; }
.date-range button:hover:not(.active) { color: var(--fg); }

/* ============================================
   CARDS / SURFACES
   ============================================ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-muted);
  gap: 12px;
}
.card__head h3 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
  color: var(--fg);
  display: flex; align-items: center; gap: 8px;
}
.card__head .count {
  font-size: 11px;
  color: var(--fg-3);
  background: var(--bg-sunken);
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}
.card__head__actions { display: flex; align-items: center; gap: 4px; }
.card__body { padding: 14px 16px; }
.card__body.flush { padding: 0; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-muted);
  font-size: 12px;
  color: var(--fg-3);
}

/* Approval inbox filters and search */
.approval-filter-card {
  position: relative;
  z-index: 20;
  margin-bottom: 14px;
  overflow: visible;
}
.approval-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  gap: 14px;
  align-items: start;
  padding: 14px;
  overflow: visible;
}
.approval-filter-toolbar__filters,
.approval-filter-toolbar__group,
.approval-filter-toolbar__actions {
  display: flex;
  align-items: center;
}
.approval-filter-toolbar__filters {
  min-width: 0;
  gap: 12px;
  flex-wrap: wrap;
}
.approval-filter-toolbar__group {
  gap: 6px;
  flex-wrap: wrap;
}
.approval-filter-toolbar__group--type {
  padding-left: 12px;
  border-left: 1px solid var(--border-muted);
}
.approval-filter-toolbar__actions {
  min-width: 0;
  justify-content: flex-end;
  gap: 12px;
}
.approval-filter-toolbar__search {
  position: relative;
  display: block;
  flex: 1 1 300px;
  width: 300px;
  min-width: 220px;
  max-width: 360px;
}
.approval-filter-toolbar__search > svg {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-3);
  pointer-events: none;
}
.approval-filter-toolbar__search > input {
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0 10px 0 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 12.5px;
  line-height: 30px;
  transition: border-color 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.approval-filter-toolbar__search > input::placeholder {
  color: var(--fg-3);
  opacity: 1;
}
.approval-filter-toolbar__search > input:hover {
  border-color: var(--border-strong);
}
.approval-filter-toolbar__search > input:focus {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--fg) 14%, transparent);
}
.approval-filter-toolbar__create {
  position: relative;
  z-index: 30;
  flex: 0 0 auto;
  padding-left: 12px;
  border-left: 1px solid var(--border-muted);
}

@media (max-width: 1050px) {
  .approval-filter-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .approval-filter-toolbar__actions {
    justify-content: stretch;
    padding-top: 12px;
    border-top: 1px solid var(--border-muted);
  }
  .approval-filter-toolbar__search {
    width: auto;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .approval-filter-toolbar__filters {
    align-items: flex-start;
  }
  .approval-filter-toolbar__group--type {
    width: 100%;
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid var(--border-muted);
    border-left: 0;
  }
  .approval-filter-toolbar__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .approval-filter-toolbar__search {
    min-width: 0;
  }
  .approval-filter-toolbar__create {
    padding-top: 10px;
    padding-left: 0;
    border-top: 1px solid var(--border-muted);
    border-left: 0;
  }
  .approval-filter-toolbar__create > .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Finance bank ledger: Hana Bank XLS import */
.fin-hana-import-trigger {
  flex: 0 0 auto;
  max-width: 100%;
}
.fin-hana-import-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-hana-import-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}
.fin-hana-import-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}
.fin-hana-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.fin-hana-import-head > div { min-width: 0; }
.fin-hana-import-head .icon-btn { flex: 0 0 auto; }
.fin-hana-import-head h3 { margin: 0; font-size: 16px; letter-spacing: 0; }
.fin-hana-import-head p { margin: 5px 0 0; color: var(--fg-3); font-size: 12px; line-height: 1.45; }
.fin-hana-import-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  margin-top: 16px;
  padding: 2px;
  border: 1px solid var(--border-muted);
  border-radius: 7px;
  background: var(--bg-sunken);
}
.fin-hana-import-mode button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-3);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.fin-hana-import-mode button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fin-hana-import-mode button.is-active {
  border-color: var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.fin-hana-import-mode button:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 1px;
}
.fin-hana-import-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid var(--border-muted);
  border-radius: 7px;
  background: var(--bg-sunken);
}
.fin-hana-import-source > div { min-width: 0; }
.fin-hana-import-source span,
.fin-hana-import-source strong { display: block; }
.fin-hana-import-source span { color: var(--fg-3); font-size: 11.5px; font-weight: 600; }
.fin-hana-import-source strong {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.fin-hana-import-source .btn { justify-content: center; text-decoration: none; }
.fin-hana-import-dialog form { margin-top: 14px; }
.fin-hana-import-source + .fin-hana-import-file { margin-top: 12px; }
.fin-hana-agent-presence {
  display: inline-flex !important;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg-3) !important;
  font-size: 11px !important;
  white-space: nowrap;
}
.fin-hana-agent-presence::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #98a2b3;
}
.fin-hana-agent-presence.is-online { color: #067647 !important; }
.fin-hana-agent-presence.is-online::before { background: #12b76a; }
.fin-hana-agent-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.fin-hana-agent-dates label { min-width: 0; }
.fin-hana-agent-dates label > span {
  display: block;
  margin-bottom: 5px;
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 600;
}
.fin-hana-agent-dates input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
}
.fin-hana-agent-dates input:focus-visible {
  outline: 2px solid rgba(15, 23, 42, .18);
  outline-offset: 1px;
}
.fin-hana-agent-dates input:disabled { opacity: .62; }
.fin-hana-agent-job {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid #b2ccff;
  border-radius: 7px;
  background: #f5f8ff;
  color: #175cd3;
}
.fin-hana-agent-job strong,
.fin-hana-agent-job span { display: block; }
.fin-hana-agent-job strong { font-size: 12.5px; line-height: 1.4; }
.fin-hana-agent-job span { margin-top: 3px; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.fin-hana-agent-job.is-failed,
.fin-hana-agent-job.is-cancelled {
  border-color: #fecdca;
  background: #fef3f2;
  color: #b42318;
}
.fin-hana-agent-job.is-completed {
  border-color: #a6f4c5;
  background: #ecfdf3;
  color: #067647;
}
.fin-hana-agent-job:not(.is-failed):not(.is-cancelled):not(.is-completed) > .icon {
  animation: fin-hana-spin 1.2s linear infinite;
}
@keyframes fin-hana-spin { to { transform: rotate(360deg); } }
.fin-hana-import-file {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 11px;
  row-gap: 3px;
  align-items: center;
  min-height: 94px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  outline: 0;
  background: var(--bg);
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 120ms var(--ease-out), background 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}
.fin-hana-import-file:hover,
.fin-hana-import-file.is-dragging {
  border-color: var(--fg-2);
  background: var(--bg-sunken);
}
.fin-hana-import-file:focus-visible {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, .14);
}
.fin-hana-import-file.is-invalid {
  border-color: #b42318;
  background: #fff8f7;
}
.fin-hana-import-file[aria-disabled="true"] {
  cursor: wait;
  opacity: .64;
}
.fin-hana-import-file > .icon {
  grid-row: 1 / 3;
  color: var(--fg-3);
}
.fin-hana-import-file strong,
.fin-hana-import-file span {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
}
.fin-hana-import-file strong { align-self: end; color: var(--fg); font-size: 12.5px; line-height: 1.35; }
.fin-hana-import-file span { align-self: start; color: var(--fg-3); font-size: 11.5px; line-height: 1.35; }
.fin-hana-import-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.fin-hana-import-note { margin: 8px 0 0; color: var(--fg-3); font-size: 11.5px; line-height: 1.45; }
.fin-hana-import-error {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #fecdca;
  border-radius: 7px;
  background: #fef3f2;
  color: #b42318;
  font-size: 11.5px;
  line-height: 1.45;
}
.fin-hana-import-result {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #a6f4c5;
  border-radius: 7px;
  background: #ecfdf3;
  color: #067647;
}
.fin-hana-import-result strong, .fin-hana-import-result span { display: block; }
.fin-hana-import-result strong { font-size: 13px; }
.fin-hana-import-result span { margin-top: 3px; font-size: 11.5px; line-height: 1.4; }
.fin-hana-import-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-muted);
}
.fin-hana-import-actions button { justify-content: center; }
.fin-hana-import-active-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.fin-hana-import-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .fin-hana-import-backdrop {
    place-items: end center;
    padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left));
  }
  .fin-hana-import-dialog {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 14px;
  }
  .fin-hana-agent-dates { grid-template-columns: minmax(0, 1fr); }
  .fin-hana-import-actions { flex-direction: column-reverse; }
  .fin-hana-import-active-actions { width: 100%; flex-direction: column; }
  .fin-hana-import-actions .btn { width: 100%; min-height: 40px; }
}

@media (max-width: 360px) {
  .fin-hana-import-source { grid-template-columns: minmax(0, 1fr); }
  .fin-hana-import-source .btn { width: 100%; min-height: 36px; }
  .fin-hana-import-file { grid-template-columns: 28px minmax(0, 1fr); padding: 14px 12px; }
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1280px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.kpi__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; min-width: 0;
}
.kpi__label {
  font-size: 11.5px;
  color: var(--fg-3);
  font-weight: 500;
  letter-spacing: 0.01em;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.kpi__delta { flex-shrink: 0; }
.kpi__label .icon { color: var(--fg-4); width: 13px; height: 13px; }
.kpi__delta {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  display: flex; align-items: center; gap: 2px;
}
.kpi__delta.up { background: var(--success-bg); color: var(--success); }
.kpi__delta.down { background: var(--danger-bg); color: var(--danger); }
.kpi__delta.flat { background: var(--bg-sunken); color: var(--fg-3); }
[data-theme="dark"] .kpi__delta.up { background: rgba(15,185,129,0.15); }
[data-theme="dark"] .kpi__delta.down { background: rgba(229,72,77,0.15); }
.kpi__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.kpi__value .unit { font-size: 13px; font-weight: 500; color: var(--fg-3); margin-left: 3px; letter-spacing: 0; }
.kpi__sub {
  font-size: 11px;
  color: var(--fg-3);
}
.kpi__spark { height: 32px; margin-top: -4px; margin-bottom: -4px; }

/* ============================================
   STATUS / PRIORITY BADGES
   ============================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.neutral { background: var(--bg-sunken); color: var(--fg-2); border: 1px solid var(--border); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: #B47318; }
.badge.danger  { background: var(--danger-bg); color: var(--danger); }
.badge.info    { background: var(--info-bg); color: var(--info); }
.badge.solid   { background: var(--fg); color: var(--accent-fg); }
.badge.outline { background: transparent; color: var(--fg-2); border: 1px solid var(--border-strong); }
[data-theme="dark"] .badge.success { background: rgba(15,185,129,0.14); }
[data-theme="dark"] .badge.warning { background: rgba(245,166,35,0.14); color: #F5A623; }
[data-theme="dark"] .badge.danger { background: rgba(229,72,77,0.14); }
[data-theme="dark"] .badge.info { background: rgba(59,130,246,0.14); }

.priority {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  color: var(--fg-2);
}
.priority i {
  width: 8px; height: 8px;
  border-radius: 2px;
  display: block;
}
.priority.urgent i { background: var(--danger); }
.priority.high i { background: #F5A623; }
.priority.normal i { background: var(--info); }
.priority.low i { background: var(--gray-400); }

/* ============================================
   GRIDS
   ============================================ */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

/* ============================================
   DATA TABLE
   ============================================ */
.table-wrap { overflow-x: auto; }
table.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
table.dt thead th {
  text-align: left;
  font-weight: 600;
  color: var(--fg-3);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  white-space: nowrap;
  position: sticky; top: 0;
}
table.dt tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--fg);
  vertical-align: middle;
  white-space: nowrap;
}
table.dt tbody tr { transition: background 120ms; }
table.dt tbody tr:hover { background: var(--bg-sunken); cursor: pointer; }
table.dt tbody tr.selected { background: var(--bg-inset); }
table.dt .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
table.dt .muted { color: var(--fg-3); }
table.dt .doc-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-2); }
table.dt .truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.dt th .sort { color: var(--fg-4); margin-left: 4px; display: inline-block; vertical-align: middle; }

table.approval-list-table {
  table-layout: fixed;
}
table.approval-list-table th,
table.approval-list-table td {
  padding-left: 8px;
  padding-right: 8px;
}
table.approval-list-table .approval-list-table__title,
table.approval-list-table .approval-list-table__document {
  white-space: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
table.approval-list-table .approval-list-table__number,
table.approval-list-table .approval-list-table__department,
table.approval-list-table .approval-list-table__date {
  overflow: hidden;
  text-overflow: ellipsis;
}
table.approval-list-table .approval-list-table__document > * {
  max-width: 100%;
}

.checkbox {
  width: 14px; height: 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 3.5px;
  display: inline-block;
  background: var(--bg-elev);
  vertical-align: middle;
  position: relative;
  cursor: pointer;
}
.checkbox.checked {
  background: var(--fg);
  border-color: var(--fg);
}
.checkbox.checked::after {
  content: ""; position: absolute;
  inset: 2px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2.5 6.5l2.5 2.5 4.5-5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}

/* Filter bar */
.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-muted);
  background: var(--bg-elev);
  flex-wrap: wrap;
}
.filter-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-2);
  font-weight: 500;
}
.filter-pill .key { color: var(--fg-3); font-weight: 500; }
.filter-pill .val { color: var(--fg); font-weight: 600; }
.filter-pill .x { color: var(--fg-4); margin-left: 2px; }
.filter-pill.add { border-style: dashed; color: var(--fg-3); }

.search-mini {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--fg-3);
  min-width: 180px;
}
.search-mini input { border: 0; background: transparent; outline: 0; flex: 1; color: var(--fg); }

/* ============================================
   AVATARS
   ============================================ */
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 12.5px; }
.avatar.dark { background: var(--fg); color: var(--accent-fg); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid var(--bg-elev); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-more {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 7px;
  background: var(--bg-sunken);
  border: 2px solid var(--bg-elev);
  border-radius: 999px;
  font-size: 10.5px; font-weight: 600; color: var(--fg-2);
  margin-left: -6px;
}

/* ============================================
   LISTS (notifications, activity)
   ============================================ */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-muted);
  cursor: pointer;
  transition: background 120ms;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--bg-sunken); }
.list-row .leading { flex-shrink: 0; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .body .title {
  font-size: 12.5px; font-weight: 500; color: var(--fg);
  display: flex; gap: 6px; align-items: baseline;
  letter-spacing: -0.005em;
}
.list-row .body .title .badge { flex-shrink: 0; }
.list-row .body .meta {
  font-size: 11.5px; color: var(--fg-3); margin-top: 2px;
  display: flex; gap: 8px;
}
.list-row .body .meta b { color: var(--fg-2); font-weight: 500; }
.list-row .trail { font-size: 11px; color: var(--fg-4); flex-shrink: 0; padding-top: 2px; }

/* AI banner */
.ai-banner {
  display: flex; gap: 14px;
  padding: 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-elev);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.ai-banner::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--fg);
}
.ai-banner__icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--fg);
  color: var(--accent-fg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ai-banner__body { flex: 1; min-width: 0; }
.ai-banner__body .eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--fg-3);
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.ai-banner__body .eyebrow .pulse {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px rgba(15,185,129,0.18);
}
.ai-banner__body .text {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
  letter-spacing: -0.005em;
}
.ai-banner__body .text b { font-weight: 700; }
.ai-banner__body .actions { display: flex; gap: 8px; margin-top: 10px; }

/* ============================================
   APPROVAL TIMELINE / WORKFLOW STEPPER
   ============================================ */
.stepper {
  display: flex;
  gap: 0;
  align-items: stretch;
}
.step {
  flex: 1;
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px;
  position: relative;
  border-right: 1px solid var(--border-muted);
}
.step:last-child { border-right: 0; }
.step .who { font-size: 11.5px; font-weight: 600; color: var(--fg); }
.step .role { font-size: 10.5px; color: var(--fg-3); }
.step .when { font-size: 10.5px; color: var(--fg-4); margin-top: 2px; }
.step .badge { align-self: flex-start; margin-top: 2px; }
.step.current { background: var(--bg-sunken); }
.step.current::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px; background: var(--fg);
}
.step.done .who { color: var(--fg-2); }

/* ============================================
   CONTEXT (RIGHT) PANEL
   ============================================ */
.context {
  width: 340px;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.context.hidden { display: none; }
.context__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.context__head h3 { font-size: 12px; font-weight: 700; margin: 0; color: var(--fg); letter-spacing: 0.02em; text-transform: uppercase; }
.context__scroll { flex: 1; overflow-y: auto; }
.context-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-muted);
}
.context-section:last-child { border-bottom: 0; }
.context-section__label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-4);
  margin-bottom: 8px;
}
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 10px; font-size: 12px; }
.kv .k { color: var(--fg-3); }
.kv .v { color: var(--fg); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ============================================
   ANIMATED ENTRANCE
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.page > * { animation: fadeIn 280ms var(--ease-out) both; }
.page > *:nth-child(1) { animation-delay: 0ms; }
.page > *:nth-child(2) { animation-delay: 30ms; }
.page > *:nth-child(3) { animation-delay: 60ms; }
.page > *:nth-child(4) { animation-delay: 90ms; }
.page > *:nth-child(5) { animation-delay: 120ms; }

/* ============================================
   MAIL CENTER
   ============================================ */
.mail-shell {
  display: grid;
  grid-template-columns: 180px minmax(390px, 32%) minmax(0, 1fr);
  height: 100%;
  background: var(--bg-elev);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.mail-folders {
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  min-height: 0;
  overflow-y: auto;
}
.mail-folders__compose {
  width: 100%;
  margin-bottom: 10px;
  height: 32px;
  background: var(--fg);
  color: var(--accent-fg);
  border: 0;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mail-list {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg);
  min-height: 0;
  overflow: hidden;
}
.mail-list__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.mail-list__head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.mail-list__scroll { flex: 1; min-height: 0; overflow-y: auto; }
.mail-row {
  padding: 0 10px;
  border-bottom: 1px solid var(--border-muted);
  cursor: pointer;
  transition: background 120ms;
  display: block;
  border-left: 3px solid transparent;
}
.mail-row:hover { background: var(--bg-sunken); }
.mail-row.unread { border-left-color: var(--info); }
.mail-row.unread .mail-row__from,
.mail-row.unread .mail-row__subject { font-weight: 700; color: var(--fg); }
.mail-row.selected { background: var(--bg-sunken); border-left-color: var(--fg); }
.mail-row__line { display: flex; align-items: center; gap: 6px; height: 34px; min-width: 0; }
.mail-row__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mail-row__from {
  flex: 0 0 112px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.005em;
}
.mail-row__time {
  flex: 0 0 88px;
  min-width: 0;
  text-align: right;
  font-size: 10.5px;
  color: var(--fg-3);
  white-space: nowrap;
}
.mail-row__subject {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--fg-2);
  font-weight: 500;
}
.mail-row__preview-inline { color: var(--fg-3); font-weight: 400; }
.mail-row__attachment { flex: 0 0 14px; width: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-3); }
.mail-row__preview { font-size: 11.5px; color: var(--fg-3); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mail-row__meta { display: flex; align-items: center; gap: 6px; margin-left: 2px; flex: 0 1 auto; min-width: 0; overflow: hidden; }

.mail-detail { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--bg-elev); }
.mail-detail__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mail-detail__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 100px; }
.mail-compose__form {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 24px;
}
.mail-compose__editor {
  flex: 1 0 300px;
  width: 100%;
  min-height: 300px;
  max-height: none;
  resize: vertical;
  overflow: auto;
}
.mail-detail__subject {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 14px;
  line-height: 1.3;
}
.mail-detail__meta {
  display: flex; gap: 12px; align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 22px;
}
.mail-detail__from {
  flex: 1;
  font-size: 12.5px;
}
.mail-detail__from .name { font-weight: 700; color: var(--fg); }
.mail-detail__from .email { color: var(--fg-3); margin-left: 4px; }
.mail-detail__from .to { color: var(--fg-3); margin-top: 3px; font-size: 12px; }
.mail-detail__time { color: var(--fg-3); font-size: 11.5px; text-align: right; }

.mail-body p { font-size: 14px; line-height: 1.7; color: var(--fg); margin: 0 0 14px; }
.mail-body p strong { color: var(--fg); font-weight: 700; }
.mail-body .quoted-doc {
  margin: 18px 0;
  padding: 16px 18px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 14px;
}
.mail-body .quoted-doc .ic {
  width: 36px; height: 44px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 5px; display: grid; place-items: center;
  color: var(--fg-2);
  flex-shrink: 0;
  position: relative;
}
.mail-body .quoted-doc .ic::after {
  content: "PDF"; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 7px; font-weight: 800; color: var(--fg-3); letter-spacing: 0.08em;
}
.mail-body .quoted-doc .info { flex: 1; min-width: 0; }
.mail-body .quoted-doc .info .name { font-size: 13px; font-weight: 600; color: var(--fg); }
.mail-body .quoted-doc .info .desc { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; }

.mail-shell.mail-shell--webapp {
  grid-template-columns: minmax(156px, 220px) minmax(0, 1fr);
}
.mail-shell.mail-shell--webapp .mail-detail {
  display: none;
}
.mail-shell.mail-shell--webapp .mail-list {
  border-right: 0;
  min-width: 0;
}
.mail-shell.mail-shell--webapp .mail-list__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 6px;
  align-items: stretch;
}
.mail-shell.mail-shell--webapp .mail-list__head h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-shell.mail-shell--webapp .mail-list__head-actions {
  justify-content: flex-end;
  gap: 6px;
}
.mail-shell.mail-shell--webapp .mail-list__compose-filter {
  margin-left: auto;
  height: 28px;
  min-width: 62px;
  padding: 0 12px;
  white-space: nowrap;
}
.mail-shell.mail-shell--webapp .mail-list__head + div {
  padding: 8px 10px !important;
}
.mail-shell.mail-shell--webapp .mail-list__head + div > div:first-child {
  grid-template-columns: minmax(0, 1fr) 86px 78px !important;
}
.mail-shell.mail-shell--webapp .mail-row {
  padding: 0 12px;
}
.mail-shell.mail-shell--webapp .mail-row__line {
  display: grid;
  grid-template-columns: 20px 18px minmax(76px, .26fr) minmax(0, 1fr) 14px max-content;
  gap: 8px;
  height: auto;
  min-height: 42px;
  align-items: center;
}
.mail-shell.mail-shell--webapp .mail-row__from,
.mail-shell.mail-shell--webapp .mail-row__subject,
.mail-shell.mail-shell--webapp .mail-row__time {
  flex: initial;
  width: auto;
}
.mail-shell.mail-shell--webapp .mail-row__from {
  flex-basis: auto;
}
.mail-shell.mail-shell--webapp .mail-row__subject {
  color: var(--fg);
  font-size: 13px;
}
.mail-shell.mail-shell--webapp .mail-row__time {
  flex-basis: auto;
  font-size: 10.5px;
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open {
  grid-template-columns: minmax(0, 1fr);
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-folders,
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-list {
  display: none;
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-detail {
  display: flex;
  min-width: 0;
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-detail__bar {
  gap: 8px;
  flex-wrap: wrap;
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-detail__bar .row {
  flex-wrap: wrap;
}
.mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-detail__scroll {
  box-sizing: border-box;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 22px 24px 110px;
}
.mail-shell.mail-shell--webapp .mail-detail__back {
  margin-right: 4px;
}
.mail-shell.mail-shell--webapp .mail-detail__subject {
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.mail-shell.mail-shell--webapp .mail-detail__meta {
  align-items: center;
}
.mail-shell.mail-shell--webapp .mail-body {
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.mail-shell.mail-shell--webapp .mail-body p,
.mail-shell.mail-shell--webapp .mail-body li,
.mail-shell.mail-shell--webapp .mail-body div {
  max-width: 100%;
}

@media (max-width: 520px) {
  .mail-shell.mail-shell--webapp {
    grid-template-columns: minmax(0, 1fr);
  }
  .mail-shell.mail-shell--webapp:not(.mail-shell--detail-open) .mail-folders {
    display: none;
  }
  .mail-shell.mail-shell--webapp .mail-list__head {
    padding: 8px 10px;
  }
  .mail-shell.mail-shell--webapp .mail-list__rule-btn {
    width: 28px;
    padding: 0;
    font-size: 0;
    gap: 0;
  }
  .mail-shell.mail-shell--webapp .mail-row__line {
    grid-template-columns: 20px 18px minmax(66px, .32fr) minmax(0, 1fr) 14px max-content;
  }
  .mail-shell.mail-shell--webapp.mail-shell--detail-open .mail-detail__scroll {
    padding: 18px 16px 104px;
  }
}

.attachment-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12.5px;
  background: var(--bg-elev);
}
.attachment-row + .attachment-row { margin-top: 6px; }
.attachment-row .ic {
  width: 30px; height: 30px;
  background: var(--bg-sunken);
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--fg-2);
}
.attachment-row .info { flex: 1; min-width: 0; }
.attachment-row .info .name { font-weight: 600; color: var(--fg); }
.attachment-row .info .meta { font-size: 11px; color: var(--fg-3); }

/* ============================================
   APPROVAL CENTER specific
   ============================================ */
.approval-shell {
  display: grid;
  grid-template-columns: 1fr 420px;
  height: 100%;
}
.approval-list-panel {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.approval-detail {
  background: var(--bg-elev);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.approval-detail__head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.approval-detail__scroll { flex: 1; overflow-y: auto; padding: 18px 20px 80px; }
.approval-detail__foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
  background: var(--bg-elev);
}
.approval-detail__foot .btn { flex: 1; height: 38px; justify-content: center; font-size: 13px; }
.approval-detail__foot .btn.danger { color: var(--danger); border-color: var(--danger); }
.approval-detail__foot .btn.success { background: var(--success); border-color: var(--success); color: white; }

/* ============================================
   ANALYTICS
   ============================================ */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.chart-grid .full { grid-column: 1 / -1; }

/* ============================================
   ADMIN
   ============================================ */
.role-table .role-cell {
  display: inline-flex; gap: 3px;
}
.role-cell .check {
  width: 14px; height: 14px;
  border-radius: 4px;
  background: var(--bg-sunken);
}
.role-cell .check.on { background: var(--fg); }
.role-cell .check.partial { background: var(--bg-inset); border: 1px solid var(--fg); }

/* ============================================
   QUICK ACTIONS FAB
   ============================================ */
.fab {
  position: fixed;
  right: 360px;
  bottom: 22px;
  display: flex;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
}
.fab__btn {
  display: flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--fg-2);
  border: 0;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
}
.fab__btn:hover { background: var(--bg-sunken); color: var(--fg); }
.fab__btn.primary { background: var(--fg); color: var(--accent-fg); }
.fab__btn.primary:hover { background: var(--accent-hover); }

/* Empty state helper */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--fg-3);
  text-align: center;
}
.empty .glyph {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--bg-sunken);
  display: grid; place-items: center;
  margin-bottom: 12px;
  color: var(--fg-4);
}
.empty .ttl { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.empty .sub { font-size: 12px; margin-top: 4px; }

/* ===== utility ===== */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--fg-3); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.flex1 { flex: 1; }
.spacer { flex: 1; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.dot-sep { color: var(--fg-4); margin: 0 2px; }

.mobile-ui-size-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.mobile-ui-size-buttons button {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 600;
}
.mobile-ui-size-buttons button.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--accent-fg);
}
.notification-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.notification-actions .btn:disabled {
  opacity: .48;
  cursor: not-allowed;
}
.notification-consent {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
  padding: 20px;
  pointer-events: none;
}
.notification-consent__panel {
  width: min(420px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}
.notification-consent__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--fg);
}
.notification-consent__copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.notification-consent__copy b {
  font-size: 13px;
}
.notification-consent__copy span {
  font-size: 11.5px;
  color: var(--fg-3);
  white-space: normal;
}
.notification-consent__actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.notice-stack {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 80;
  pointer-events: none;
}
.notice-toast {
  width: min(340px, calc(100vw - 28px));
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
}
.notice-toast b {
  font-size: 12.5px;
}
.notice-toast span {
  font-size: 11.5px;
  color: var(--fg-3);
  white-space: normal;
}

.global-call-alert {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  z-index: 10060;
  width: min(430px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  background: #121923;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .34);
  transform: translateX(-50%);
}
.global-call-alert__signal {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #263244;
  color: #fff;
}
.global-call-alert__signal span {
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(34, 197, 111, .55);
  border-radius: 21px;
  animation: global-call-pulse 1.4s ease-out infinite;
}
.global-call-alert__copy { min-width: 0; display: grid; gap: 4px; }
.global-call-alert__copy small { color: #aeb9c7; font-size: 11px; }
.global-call-alert__copy strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.global-call-alert__actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.global-call-alert__actions button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.global-call-alert__actions .decline { background: #ef4d55; }
.global-call-alert__actions .answer { background: #22c56f; }
@keyframes global-call-pulse {
  from { opacity: .9; transform: scale(.9); }
  to { opacity: 0; transform: scale(1.22); }
}

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace";
  }
  .app.app--storage-open {
    grid-template-columns: 60px minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace";
  }
  .storage-panel {
    display: none;
  }
  .context {
    display: none !important;
  }
  .fab {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
  }
}

@supports (height: 100dvh) {
  .app {
    height: 100dvh;
  }
}

@media (display-mode: standalone) {
  .app {
    grid-template-rows: calc(56px + var(--safe-top)) 1fr;
    padding-right: var(--safe-right);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
  }
  .topbar {
    padding-top: var(--safe-top);
  }
}

@media (pointer: coarse), (display-mode: standalone) {
  html, body, #root {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }
  .app {
    width: calc(100vw / var(--mobile-ui-zoom)) !important;
    height: calc(100vh / var(--mobile-ui-zoom)) !important;
    min-width: calc(100vw / var(--mobile-ui-zoom));
    max-width: none;
    transform: scale(var(--mobile-ui-zoom));
    transform-origin: top left;
  }
  @supports (height: 100dvh) {
    html, body, #root {
      height: 100dvh;
    }
    .app {
      height: calc(100dvh / var(--mobile-ui-zoom)) !important;
    }
  }
  .page {
    max-width: none;
  }
  .page-header {
    gap: 16px;
  }
  .page-header__title h1 {
    font-size: 22px;
  }
  .notice-stack {
    right: 16px;
    bottom: calc(76px + var(--safe-bottom));
  }
  .notification-consent {
    padding: 14px;
    place-items: end center;
  }
  .notification-consent__panel {
    width: min(420px, calc((100vw / var(--mobile-ui-zoom)) - 28px));
  }
}

@media (max-width: 1180px), (pointer: coarse), (display-mode: standalone) {
  .context.context--overlay {
    display: flex !important;
    position: fixed;
    top: calc(56px + var(--safe-top));
    right: 0;
    bottom: 0;
    width: min(420px, calc((100vw / var(--mobile-ui-zoom)) - 72px));
    max-width: calc((100vw / var(--mobile-ui-zoom)) - 72px);
    z-index: 65;
    border-left: 1px solid var(--border);
    box-shadow: -18px 0 36px rgba(15, 20, 25, .18);
  }
}
