:root {
  font-family: "DM Sans", "Noto Sans Lao", sans-serif;
  color: #1c2822;
  background: #f3f5f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #184234;
  --green-dark: #113126;
  --green-soft: #e9f3ec;
  --mint: #e7f1e9;
  --accent: #e85d22;
  --accent-soft: #fdf0ea;
  --orange: #d77f4a;
  --text: #1c2822;
  --text-secondary: #4c5951;
  --muted: #76837a;
  --line: #e6ebe5;
  --surface: #ffffff;
  --canvas: #f3f5f2;
  --shadow-sm: 0 1px 2px rgba(16, 32, 24, .04), 0 4px 12px rgba(16, 32, 24, .03);
  --shadow-md: 0 6px 20px rgba(16, 32, 24, .07);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--text); font-size: 13px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.ui-icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }

[hidden] { display: none !important; }
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Sidebar */
.sidebar {
  width: 256px;
  flex: 0 0 256px;
  padding: 22px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; justify-content: center; padding: 2px 6px 16px; color: var(--text); text-decoration: none; }
.brand-logo { width: 186px; max-width: 100%; height: auto; object-fit: contain; display: block; transition: opacity .15s ease; }
.brand-logo:hover { opacity: .88; }

.workspace-switch {
  margin: 0 2px 22px;
  padding: 10px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbf9;
}
.workspace-avatar, .profile-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: #d49063;
  font-weight: 700;
  font-size: 13px;
}
.workspace-avatar {
  background: #ffffff;
  border: 1px solid #dfe6e0;
  padding: 3px;
  overflow: hidden;
  color: var(--green);
}
.workspace-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.workspace-name, .profile-name { min-width: 0; flex: 1; }
.workspace-name strong, .profile-name strong { display: block; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.workspace-name small, .profile-name small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.switch-chevron { color: #879087; display: inline-flex; align-items: center; }

.nav-caption { color: #8e9890; text-transform: uppercase; font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 0 12px 8px; }
.main-nav { display: grid; gap: 4px; }
.nav-item {
  position: relative;
  width: 100%;
  border: 0;
  background: transparent;
  color: #556259;
  padding: 8px 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-item:hover { background: #f4f7f4; color: var(--green); }
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 700; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
}
.nav-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-item:hover .nav-icon { transform: scale(1.06); }
.nav-item.active .nav-icon { color: #ffffff; }

.nav-item[data-view="overview"] .nav-icon { background: #e7f3ec; color: #184234; }
.nav-item[data-view="overview"].active .nav-icon {
  background: linear-gradient(135deg, #21604a, #153e30);
  box-shadow: 0 4px 10px rgba(24, 66, 52, .26);
}
.nav-item[data-view="transactions"] .nav-icon { background: #e6f6f4; color: #0f766e; }
.nav-item[data-view="transactions"].active .nav-icon {
  background: linear-gradient(135deg, #149187, #0f766e);
  box-shadow: 0 4px 10px rgba(15, 118, 110, .25);
}
.nav-item[data-view="documents"] .nav-icon { background: #fff0e8; color: #d95b1e; }
.nav-item[data-view="documents"].active .nav-icon {
  background: linear-gradient(135deg, #f3732c, #d95318);
  box-shadow: 0 4px 10px rgba(217, 91, 30, .28);
}
.nav-item[data-view="customers"] .nav-icon { background: #edf3fe; color: #2563eb; }
.nav-item[data-view="customers"].active .nav-icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 10px rgba(37, 99, 235, .26);
}
.nav-item[data-view="tax"] .nav-icon { background: #fef5e4; color: #b45309; }
.nav-item[data-view="tax"].active .nav-icon {
  background: linear-gradient(135deg, #f59e0b, #c25e0a);
  box-shadow: 0 4px 10px rgba(180, 83, 9, .26);
}
.nav-item[data-view="settings"] .nav-icon { background: #f1f5f9; color: #475569; }
.nav-item[data-view="settings"].active .nav-icon {
  background: linear-gradient(135deg, #64748b, #334155);
  box-shadow: 0 4px 10px rgba(51, 65, 85, .24);
}
.nav-count { margin-left: auto; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 700; background: #dfece2; color: var(--green); }

.sidebar-bottom { margin-top: auto; padding-top: 14px; }
.help-card {
  position: relative;
  margin: 0 2px 14px;
  padding: 14px 13px 12px;
  background: linear-gradient(135deg, #f8f7f1, #f3f1e7);
  border: 1px solid #ebe8da;
  border-radius: 12px;
}
.help-spark { position: absolute; right: 11px; top: 10px; color: #b98f46; display: inline-flex; }
.help-card strong { font-size: 12px; display: block; padding-right: 22px; color: var(--text); }
.help-card p { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 5px 0 8px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.text-button:hover { text-decoration: underline; }
.settings-link { margin-bottom: 10px; }
.profile { border-top: 1px solid var(--line); padding: 13px 4px 0; display: flex; align-items: center; gap: 10px; }
.profile-avatar { background: linear-gradient(135deg, #56735d, #3b5542); border-radius: 50%; font-size: 11px; }

.icon-button {
  border: 0;
  background: transparent;
  color: #6b776e;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.icon-button:hover { background: #eff3ee; color: var(--text); }

/* Main & Topbar */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 66px;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.breadcrumbs { display: flex; gap: 9px; align-items: center; color: #7e8980; font-size: 12px; }
.breadcrumbs strong { color: var(--text); font-weight: 700; }
.crumb-separator { color: #9aa39c; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.search-box {
  height: 36px;
  width: 215px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #8b968e;
  background: #fafbf9;
  transition: border-color .15s ease, background .15s ease;
}
.search-box:focus-within { border-color: #88a790; background: #fff; box-shadow: 0 0 0 3px rgba(24, 66, 52, .08); }
.search-box input { border: 0; outline: 0; width: 100%; font-size: 12px; color: var(--text); background: transparent; }
.search-box input::placeholder { color: #96a098; }

.language-button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  padding: 0 11px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  transition: border-color .15s ease, background .15s ease;
}
.language-button:hover { background: #f6f8f5; border-color: #cbd5cc; }
.notification-button { position: relative; width: 36px; height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 9px; }
.notification-button i { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); border: 1.5px solid white; }

.button {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  transition: all .15s ease;
  white-space: nowrap;
}
.button-primary { background: var(--green); color: white; border: 1px solid var(--green); box-shadow: 0 2px 6px rgba(24, 66, 52, .18); }
.button-primary:hover { background: var(--green-dark); transform: translateY(-1px); }
.button-secondary { border: 1px solid #dce2db; background: white; color: #414e45; }
.button-secondary:hover { border-color: #bfc9bf; background: #f9faf8; }
.button-save-pc { border-color: #b7d2c3; color: var(--green); background: #f4faf6; font-weight: 700; }
.button-save-pc:hover { border-color: var(--green); background: #e8f4ec; }
.top-add { height: 36px; }
.mobile-menu { display: none; }

/* Page Wrap & Heading */
.page-wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 28px 36px 26px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.eyebrow { color: #7e8980; font-size: 11px; font-weight: 600; margin-bottom: 5px; letter-spacing: .2px; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.6px; line-height: 1.25; font-weight: 700; color: #16221c; }
.page-heading p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.heading-actions { display: flex; gap: 9px; padding-bottom: 2px; }

/* KPI Metric Cards */
.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  min-height: 144px;
  padding: 18px 19px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d6dfd7; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #67746b; font-size: 12px; font-weight: 600; }
.metric-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
}
.metric-icon.orange { color: var(--accent); background: var(--accent-soft); }
.metric-icon.amber { color: #b7771d; background: #fdf5e6; }
.metric-value {
  margin-top: 12px;
  font-size: clamp(19px, 1.9vw, 25px);
  font-weight: 700;
  color: #16221c;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.metric-foot { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 11px; color: var(--muted); }
.trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: #e6f4ea;
  color: #1e6e3e;
}
.trend-pill.down { background: #fdece6; color: #c44a1c; }
.trend-pill.neutral { background: #f0f2f0; color: #5c6860; }

.metric-card.primary {
  color: white;
  background: linear-gradient(135deg, #1d4e3d 0%, #123328 100%);
  border-color: #163e30;
  box-shadow: 0 8px 24px rgba(18, 51, 40, .2);
}
.metric-card.primary::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -36px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.metric-card.primary .metric-top { color: #c7ddd0; }
.metric-card.primary .metric-foot { color: #b7d0c1; }
.metric-card.primary .metric-icon { color: #f6cf7f; background: rgba(255, 255, 255, .14); backdrop-filter: blur(4px); }
.metric-card.primary .metric-value { color: #ffffff; }
.metric-card.primary .trend-pill { background: rgba(255, 255, 255, .16); color: #f6cf7f; }
.currency-pill {
  position: absolute;
  right: 16px;
  bottom: 16px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #e4f0e7;
}

/* Dashboard Two-Column Panels */
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 16px; margin-top: 18px; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.panel-head { min-height: 60px; padding: 12px 20px; display: flex; gap: 12px; justify-content: space-between; align-items: center; border-bottom: 1px solid #f0f2ef; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 700; color: #1b2821; }
.panel-subtitle { color: var(--muted); font-size: 11px; margin-top: 2px; }
.panel-link { padding: 5px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--green); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; transition: background .15s ease; }
.panel-link:hover { background: var(--green-soft); }

/* Chart Header Summary & Interactive Grouped Bar Chart */
.chart-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chart-legend { display: flex; gap: 14px; align-items: center; color: #5b675e; font-size: 11.5px; font-weight: 600; }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 3px; background: #266b4e; }
.legend-dot.expense { background: var(--accent); }
.chart-summary-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #f2f5f2; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.chart-pill.positive { background: #e8f4ec; color: #1a663b; }
.chart-pill.negative { background: #fdeee7; color: #c44a1c; }

.bar-chart { padding: 18px 20px 14px; }
.bar-chart-stage { display: flex; gap: 10px; align-items: stretch; height: 210px; }
.bar-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 24px;
  font-size: 10px;
  font-weight: 600;
  color: #8c968e;
  text-align: right;
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}
.bar-plot-area {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bar-grid-lines {
  position: absolute;
  inset: 0 0 24px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.bar-grid-lines span { border-top: 1px dashed #e6ebe5; width: 100%; height: 0; }
.bar-grid-lines span:last-child { border-top: 1px solid #dde3dc; }

.bar-months {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
}
.bar-month-col {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 2px;
  border-radius: 8px;
  transition: background .15s ease;
}
.bar-month-col:hover { background: rgba(24, 66, 52, .04); }
.bar-month-col.current { background: rgba(24, 66, 52, .045); }
.bar-pair {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding-top: 8px;
}
.bar {
  width: clamp(6px, 1.1vw, 13px);
  border-radius: 5px 5px 2px 2px;
  transition: height .3s ease, filter .15s ease;
  min-height: 2px;
}
.bar.empty { background: #e8ede8 !important; height: 3px !important; opacity: .7; }
.bar.income { background: linear-gradient(180deg, #2b7a57 0%, #194d38 100%); }
.bar.expense { background: linear-gradient(180deg, #f3864c 0%, #d95722 100%); }
.bar-month-col:hover .bar:not(.empty) { filter: brightness(1.08); }
.bar-month-label {
  height: 24px;
  display: flex;
  align-items: center;
  font-size: 10.5px;
  color: #7c877e;
  font-weight: 500;
}
.bar-month-col.current .bar-month-label { color: var(--green); font-weight: 700; }

.bar-tooltip {
  position: absolute;
  bottom: calc(100% - 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #17271f;
  color: #fff;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 1.45;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 6;
}
.bar-month-col:hover .bar-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }
.bar-tooltip strong { display: block; color: #f6cf7f; margin-bottom: 2px; font-size: 11px; }

/* Recent Activity */
.activity-list { padding: 6px 18px; }
.activity-row { display: flex; gap: 11px; align-items: center; padding: 12px 4px; border-bottom: 1px solid #f0f2ef; transition: background .15s ease; border-radius: 8px; }
.activity-row:hover { background: #fafbf9; }
.activity-row:last-child { border-bottom: 0; }
.activity-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: #e8f4ec; color: #1e6c42; }
.activity-icon.expense { color: var(--accent); background: var(--accent-soft); }
.activity-detail { flex: 1; min-width: 0; }
.activity-detail strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-detail small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.activity-amount { text-align: right; font-size: 12.5px; font-weight: 700; white-space: nowrap; color: #19613a; font-variant-numeric: tabular-nums; }
.activity-amount.expense { color: #c44a1c; }
.activity-amount small { display: block; font-size: 10px; color: #8c968e; margin-top: 2px; font-weight: 500; }

/* Quick Actions */
.section-row { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 12px; }
.section-row h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.section-row span { color: var(--muted); font-size: 11.5px; display: block; margin-top: 2px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.quick-action {
  padding: 14px 15px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.quick-action:hover { transform: translateY(-2px); border-color: #b8cbbd; box-shadow: var(--shadow-md); }
.quick-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; color: var(--green); background: var(--green-soft); }
.quick-action:nth-child(2) .quick-icon { color: var(--accent); background: var(--accent-soft); }
.quick-action:nth-child(3) .quick-icon { color: #34549a; background: #edf1fa; }
.quick-action:nth-child(4) .quick-icon { color: #9c7424; background: #faf3e3; }
.quick-action-copy { flex: 1; min-width: 0; }
.quick-action strong { font-size: 12.5px; font-weight: 700; display: block; color: var(--text); }
.quick-action small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.quick-arrow { color: #a3aea6; transition: transform .15s ease, color .15s ease; }
.quick-action:hover .quick-arrow { transform: translateX(2px); color: var(--green); }

/* Overview Snapshot Strip (Document Breakdown + Live Exchange Rates) */
.overview-strip { display: grid; grid-template-columns: 1.15fr .85fr; gap: 15px; margin-top: 18px; }
.snapshot-card { padding: 15px 18px; display: flex; flex-direction: column; gap: 12px; }
.snapshot-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.snapshot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-stat-chip {
  flex: 1 1 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbf9;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  transition: all .15s ease;
}
.doc-stat-chip:hover { border-color: #b8cbbd; background: var(--green-soft); color: var(--green); }
.doc-stat-chip strong { font-size: 13.5px; font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }
.rate-chip {
  flex: 1 1 100px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbf9;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rate-chip span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.rate-chip strong { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Tables & Action Icon Buttons */
.table-panel { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { border-collapse: collapse; width: 100%; min-width: 640px; }
.table-scroll th { height: 42px; background: #f8faf8; color: #67746b; text-align: left; font-size: 11px; font-weight: 700; padding: 0 18px; letter-spacing: .2px; border-bottom: 1px solid var(--line); }
.table-scroll td { height: 56px; padding: 10px 18px; border-top: 1px solid #f0f2ef; color: #39463e; font-size: 12.5px; }
.table-scroll tbody tr { transition: background .12s ease; }
.table-scroll tbody tr:hover { background: #fbfcfa; }
.table-scroll td strong { color: #19251e; font-size: 12.5px; font-weight: 700; }

.pdf-export-root {
  width: 718px;
  max-width: 718px;
  background: #ffffff;
  color: #000000;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  line-height: 1.45;
}
.pdf-export-root table { min-width: 0; }
.pdf-export-root th, .pdf-export-root td { height: auto; }
.doc-id { color: #68756b; font-size: 11px; margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  background: #fdf0ea;
  color: #c74a18;
  padding: 2px 7px;
  border-radius: 999px;
}

.status {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #eaf4ed;
  color: #1f6840;
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending { background: #fdf4e4; color: #9c6b17; }
.status.draft { background: #eff1ef; color: #616b63; }
.status.sent { background: #eaf1fb; color: #26599c; }
.status.approved { background: #e8f5ee; color: #17663b; }
.status.overdue { background: #fdece8; color: #b74225; }

.status-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eaf4ed;
  color: #1f6840;
  border: 1px solid #c5e2cf;
  transition: filter .15s ease, box-shadow .15s ease;
}
.status-select-wrap:hover,
.status-select-wrap:focus-within {
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
  filter: brightness(0.97);
}
.status-select-wrap.pending { background: #fdf4e4; color: #9c6b17; border-color: #f2d8a7; }
.status-select-wrap.draft { background: #eff1ef; color: #5b655d; border-color: #d6dcd6; }
.status-select-wrap.sent { background: #eaf1fb; color: #26599c; border-color: #c5daf7; }
.status-select-wrap.approved,
.status-select-wrap.paid,
.status-select-wrap.accepted { background: #e8f5ee; color: #17663b; border-color: #bfe3cc; }
.status-select-wrap.overdue { background: #fdece8; color: #b74225; border-color: #f5c5b9; }
.status-select-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  left: 10px;
  pointer-events: none;
}
.status-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 24px 5px 21px;
  cursor: pointer;
  outline: none;
  border-radius: 999px;
  line-height: 1.2;
}
.status-select option {
  background: #ffffff;
  color: #1b2620;
  font-weight: 600;
}
.status-select-chevron {
  position: absolute;
  right: 8px;
  pointer-events: none;
  opacity: .75;
}

.row-actions { display: inline-flex; align-items: center; gap: 7px; }
.action-btn {
  position: relative;
  border: 1px solid #e4e9e4;
  background: #f8faf8;
  color: #515e55;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 32, 24, .05);
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.action-btn:hover { transform: translateY(-2px); color: #fff; }
.action-btn:active { transform: translateY(0) scale(.95); }

.action-btn.edit { color: #184234; background: #ebf5ee; border-color: #d0e5d6; }
.action-btn.edit:hover {
  background: linear-gradient(135deg, #21634b, #154031);
  border-color: #154031;
  box-shadow: 0 5px 14px rgba(24, 66, 52, .26);
}

.action-btn.pdf { color: #d94f17; background: #fff1eb; border-color: #f8d4c3; }
.action-btn.pdf:hover {
  background: linear-gradient(135deg, #f37021, #d94e14);
  border-color: #d94e14;
  box-shadow: 0 5px 14px rgba(217, 78, 20, .28);
}

.action-btn.print { color: #2563eb; background: #edf3fe; border-color: #cfe0fc; }
.action-btn.print:hover {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-color: #1d4ed8;
  box-shadow: 0 5px 14px rgba(37, 99, 235, .28);
}

.action-btn.delete { color: #dc2626; background: #fef0f0; border-color: #fad3d3; }
.action-btn.delete:hover {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: #b91c1c;
  box-shadow: 0 5px 14px rgba(220, 38, 38, .28);
}

.action-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #16241d;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 12;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  transition: opacity .15s ease, transform .15s ease;
}
.action-btn[data-tooltip]:last-child::after {
  left: auto;
  right: 0;
  transform: translateY(4px);
}
.action-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.action-btn[data-tooltip]:last-child:hover::after {
  transform: translateY(0);
}

.table-empty { padding: 36px 16px; color: var(--muted); text-align: center; font-size: 12.5px; }

/* Separated 4 Document Type Cards & Badges */
.doc-type-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.doc-type-card {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 13px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.doc-type-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.doc-type-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-type-card-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.doc-type-create-btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all .15s ease;
}
.doc-type-card-body strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); }
.doc-type-card-body small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.doc-type-card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid #f0f2ef; font-size: 11px; }
.doc-type-count { color: var(--muted); font-weight: 600; }
.doc-type-sum { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

.doc-type-card.quote .doc-type-card-icon { background: #fff1eb; color: #d94f17; }
.doc-type-card.quote .doc-type-create-btn { background: #fff1eb; color: #c74a18; border-color: #f8d4c3; }
.doc-type-card.quote .doc-type-create-btn:hover { background: #e85d22; color: #fff; }
.doc-type-card.quote.active { border-color: #e85d22; background: #fffaf7; box-shadow: 0 0 0 3px rgba(232, 93, 34, .12); }

.doc-type-card.deposit .doc-type-card-icon { background: #fef3c7; color: #b45309; }
.doc-type-card.deposit .doc-type-create-btn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.doc-type-card.deposit .doc-type-create-btn:hover { background: #d97706; color: #fff; }
.doc-type-card.deposit.active { border-color: #d97706; background: #fffdf5; box-shadow: 0 0 0 3px rgba(217, 119, 6, .14); }

.doc-type-card.invoice .doc-type-card-icon { background: #edf3fe; color: #1d4ed8; }
.doc-type-card.invoice .doc-type-create-btn { background: #edf3fe; color: #1e40af; border-color: #cfe0fc; }
.doc-type-card.invoice .doc-type-create-btn:hover { background: #1e3a5f; color: #fff; }
.doc-type-card.invoice.active { border-color: #2563eb; background: #f7faff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.doc-type-card.receipt .doc-type-card-icon { background: #e8f5ee; color: #184234; }
.doc-type-card.receipt .doc-type-create-btn { background: #e8f5ee; color: #184234; border-color: #bfe0cc; }
.doc-type-card.receipt .doc-type-create-btn:hover { background: #184234; color: #fff; }
.doc-type-card.receipt.active { border-color: #184234; background: #f4faf6; box-shadow: 0 0 0 3px rgba(24, 66, 52, .14); }

.doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
}
.doc-type-badge.quote { background: #fff1eb; color: #c74a18; }
.doc-type-badge.deposit { background: #fef3c7; color: #92400e; }
.doc-type-badge.invoice { background: #edf3fe; color: #1e40af; }
.doc-type-badge.receipt { background: #e8f5ee; color: #184234; }

.modal-type-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.modal-type-banner-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 34px; background: rgba(255, 255, 255, .75); }
.modal-type-banner strong { display: block; font-size: 13px; }
.modal-type-banner small { display: block; font-size: 11px; opacity: .85; }
.modal-type-banner.quote { background: #fff3ed; border-color: #f9cdb8; color: #b54012; }
.modal-type-banner.deposit { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.modal-type-banner.invoice { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.modal-type-banner.receipt { background: #ecfdf5; border-color: #a7f3d0; color: #14532d; }

/* 5-Preset Terms & Conditions Selector */
.terms-preset-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
.terms-preset-btn {
  border: 1.5px solid #dce2db;
  background: #fafbf9;
  border-radius: 9px;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.terms-preset-btn:hover { border-color: #9ab8a4; background: #f4f9f5; }
.terms-preset-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.terms-preset-btn strong { font-size: 11px; font-weight: 700; color: var(--text); line-height: 1.3; }
.terms-preset-btn small { font-size: 10px; color: var(--muted); line-height: 1.35; display: block; }
.terms-preset-check { color: var(--green); opacity: 0; transform: scale(.85); transition: opacity .15s ease, transform .15s ease; display: inline-flex; }
.terms-preset-btn.active {
  border-color: var(--green);
  background: #edf6f0;
  box-shadow: 0 0 0 2px rgba(24, 66, 52, .1);
}
.terms-preset-btn.active strong { color: var(--green); }
.terms-preset-btn.active .terms-preset-check { opacity: 1; transform: scale(1); }

/* Quick VAT & Deposit % Pills + Live Calculation Bar */
.quick-pct-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.quick-pct-btn {
  border: 1.5px solid #dce2db;
  background: #fafbf9;
  color: #4c5951;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  transition: all .15s ease;
}
.quick-pct-btn:hover { border-color: #9ab8a4; background: #f2f7f4; color: var(--green); }
.quick-pct-btn.vat-pill-btn.active {
  background: #fff1eb;
  border-color: #e85d22;
  color: #c74a18;
  box-shadow: 0 0 0 2px rgba(232, 93, 34, .12);
}
.quick-pct-btn.deposit-pill-btn.active {
  background: #edf6f0;
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 0 2px rgba(24, 66, 52, .12);
}
.calc-preview-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #f4f8f5;
  border: 1px solid #d4e4da;
  font-size: 12px;
  color: #46554b;
}
.calc-preview-bar strong { color: #16241d; font-variant-numeric: tabular-nums; }
.calc-preview-bar .calc-vat strong { color: #c74a18; }
.calc-preview-bar .calc-total strong { color: var(--green); font-size: 13px; }
.calc-preview-bar .calc-deposit {
  margin-left: auto;
  background: #fef3c7;
  color: #92400e;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
}
.calc-preview-bar .calc-deposit strong { color: #b45309; }

/* Toolbar & Filters */
.view-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip { border: 1px solid #dfe5de; border-radius: 999px; padding: 7px 14px; background: white; color: #5b675e; font-size: 12px; font-weight: 500; transition: all .15s ease; }
.filter-chip:hover { border-color: #c2cdc2; color: var(--green); }
.filter-chip.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }

.empty-state { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-state .empty-icon { margin: 0 auto 14px; width: 52px; height: 52px; display: grid; place-items: center; background: var(--green-soft); border-radius: 14px; color: var(--green); }
.empty-state strong { display: block; color: var(--text); font-size: 14px; }
.empty-state p { max-width: 360px; margin: 7px auto 16px; font-size: 12px; line-height: 1.6; }

/* Settings & Banners */
.currency-rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 18px; }
.rate-card { padding: 15px; border: 1px solid var(--line); background: #fafbf9; border-radius: 11px; }
.rate-card strong { display: block; font-size: 13px; color: var(--text); }
.rate-card small { color: var(--muted); font-size: 11px; }
.rate-card input { margin-top: 10px; border: 1px solid #dce2db; border-radius: 8px; padding: 8px 10px; width: 100%; background: #fff; font-size: 12.5px; font-weight: 600; }
.warning-banner { display: flex; gap: 11px; align-items: flex-start; border: 1px solid #f0e1bf; background: #fffaf0; color: #7a602e; padding: 14px 16px; border-radius: 11px; font-size: 12px; line-height: 1.6; margin-bottom: 16px; }
.warning-banner strong { display: block; font-size: 12.5px; margin-bottom: 2px; color: #5f481f; }

.footer-note { margin-top: 24px; padding-top: 12px; border-top: 1px solid #e7ece6; display: flex; gap: 18px; align-items: center; justify-content: space-between; color: #849087; font-size: 11px; }
.footer-note > span:nth-child(2) { display: flex; align-items: center; gap: 6px; }
.footer-link { color: var(--green); font-weight: 700; text-decoration: underline; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #3b9c62; }

/* Modals & Forms */
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(20, 32, 25, .42); backdrop-filter: blur(3px); }
.modal { width: min(100%, 510px); max-height: 90vh; overflow-y: auto; background: white; border-radius: 14px; box-shadow: 0 24px 60px rgba(20, 36, 26, .22); }
.modal-wide { width: min(100%, 980px); }
.modal-confirm {
  width: min(100%, 400px);
  text-align: center;
  padding: 26px 24px 22px;
}
.confirm-icon-wrap {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #feecec;
  color: #dc2626;
  border: 1px solid #fad2d2;
}
.confirm-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: #17271e;
  line-height: 1.4;
}
.confirm-detail {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: #5b6961;
  word-break: break-word;
}
.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}
.confirm-actions .button {
  min-width: 112px;
  justify-content: center;
}
.button-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, .22);
}
.button-danger:hover {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #991b1b;
  box-shadow: 0 6px 16px rgba(185, 28, 28, .28);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 24px 15px; border-bottom: 1px solid #eff1ee; }
.modal-head h2 { margin: 0; font-size: 17px; color: var(--text); }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; }
.modal-body { padding: 18px 24px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1/-1; }
.form-field label { color: #546158; font-size: 11.5px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea { min-width: 0; width: 100%; border: 1px solid #dce2db; border-radius: 8px; outline: none; padding: 9px 11px; color: #26332b; background: white; font-size: 12.5px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #5b876a; box-shadow: 0 0 0 3px #ebf4ed; }
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field small { color: var(--muted); font-size: 10.5px; }

.work-items-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.work-item-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid #c5dfd0;
  background: #edf7f1;
  color: var(--green);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.work-item-add-btn:hover { background: var(--green); color: #ffffff; border-color: var(--green); }
.work-item-add-row-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1.5px dashed #c8d5cc;
  border-radius: 8px;
  background: #fafcfa;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.work-item-add-row-btn:hover { background: #edf7f1; border-color: var(--green); }
.work-items-scroll { max-width: 100%; overflow-x: auto; }
.work-items-table { width: 100%; min-width: 700px; border-collapse: collapse; }
.work-items-table th, .work-items-table td { padding: 7px 6px; border-bottom: 1px solid #eff1ee; text-align: left; }
.work-items-table th { color: #5a675e; font-size: 11px; font-weight: 700; white-space: nowrap; background: transparent; height: auto; }
.work-items-table th:first-child, .work-item-number { width: 34px; text-align: center !important; color: #8b948b; }
.work-items-table th:nth-child(3), .work-items-table th:nth-child(4), .work-items-table th:nth-child(5) { width: 120px; }
.work-items-table th:last-child, .work-item-action-cell { width: 38px; text-align: center !important; padding: 4px; }
.work-item-remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #8c968e;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.work-item-remove-btn:hover { background: #fdece8; color: #c0392b; border-color: #f5c5b9; }
.work-items-table .work-item-input { padding: 8px 10px; font-size: 12px; }
.work-item-quantity, .work-item-price, .work-item-total { text-align: right !important; }
.work-item-total { min-width: 120px; white-space: nowrap; color: var(--text); font-size: 12px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 18px; }

.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 10px; background: #18362a; color: white; box-shadow: 0 10px 28px rgba(18, 42, 32, .25); font-size: 12.5px; font-weight: 500; animation: slide-up .18s ease-out; }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.save-doc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #f6f8f6;
  border: 1px solid #e2e8e2;
  border-radius: 10px;
  margin-bottom: 14px;
}
.save-doc-summary-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.save-doc-summary-left strong {
  font-size: 13.5px;
  color: #163a2e;
}
.save-doc-summary-meta {
  font-size: 12px;
  color: #5b6860;
}
.save-doc-summary-amount {
  font-size: 15px;
  font-weight: 700;
  color: #163a2e;
  white-space: nowrap;
}
.save-doc-formats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.save-format-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1.5px solid #e2e8e2;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.save-format-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(20, 34, 26, .08);
}
.save-format-card:focus-visible {
  outline: 2px solid #21634b;
  outline-offset: 2px;
}
.save-format-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
}
.save-format-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.save-format-title {
  font-size: 15px;
  font-weight: 700;
  color: #17271e;
}
.save-format-desc {
  font-size: 12px;
  color: #5b6860;
  line-height: 1.45;
}
.save-format-file {
  margin-top: 4px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #3f4e45;
  background: #f4f6f4;
  padding: 4px 8px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.save-format-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
}
.save-format-card.pdf {
  border-color: #f8d4c3;
  background: linear-gradient(180deg, #fffaf7 0%, #ffffff 100%);
}
.save-format-card.pdf:hover {
  border-color: #e46328;
  box-shadow: 0 10px 22px rgba(217, 78, 20, .14);
}
.save-format-card.pdf .save-format-icon {
  color: #d94f17;
  background: #ffece3;
}
.save-format-card.pdf .save-format-cta {
  color: #c2410c;
  background: #ffece3;
}
.save-format-card.excel {
  border-color: #c5e3d1;
  background: linear-gradient(180deg, #f5fbf7 0%, #ffffff 100%);
}
.save-format-card.excel:hover {
  border-color: #1f7a4c;
  box-shadow: 0 10px 22px rgba(31, 122, 76, .14);
}
.save-format-card.excel .save-format-icon {
  color: #166534;
  background: #dcfce7;
}
.save-format-card.excel .save-format-cta {
  color: #166534;
  background: #dcfce7;
}

/* Employee Login Gate */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(circle at top right, #e5f1e9 0%, #f3f5f2 48%, #f8f5ef 100%);
}
.login-card {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border: 1px solid #e0e7e1;
  border-radius: 18px;
  padding: 26px 28px 24px;
  box-shadow: 0 20px 44px rgba(17, 49, 38, .09);
}
.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.login-company-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf5ef;
  color: #184234;
  font-size: 11.5px;
  font-weight: 700;
}
.login-brand {
  text-align: center;
  margin-bottom: 18px;
}
.login-logo {
  width: 280px;
  max-width: 86%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 14px;
}
.login-company-name {
  font-size: 12px;
  font-weight: 700;
  color: #4f6056;
  letter-spacing: .3px;
}
.login-brand h1 {
  margin: 4px 0 4px;
  font-size: 21px;
  color: #143227;
}
.login-brand p {
  margin: 0;
  font-size: 12.5px;
  color: #5b6961;
}
.login-quick-section {
  margin-bottom: 16px;
}
.login-quick-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #4b5a51;
  margin-bottom: 8px;
}
.login-quick-users {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.login-user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #e1e8e2;
  background: #fafcfa;
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.login-user-chip:hover {
  border-color: #21634b;
  background: #f2f8f4;
  transform: translateY(-1px);
}
.login-user-chip.active {
  border-color: #184234;
  background: #e9f3ec;
  box-shadow: 0 3px 10px rgba(24, 66, 52, .12);
}
.login-chip-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #21634b, #154031);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.login-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.login-chip-info strong {
  font-size: 12.5px;
  color: #162e24;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-chip-info small {
  font-size: 11px;
  color: #5c6a62;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-form {
  display: grid;
  gap: 12px;
}
.login-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-password-wrap input {
  width: 100%;
  padding-right: 40px;
}
.login-eye-btn {
  position: absolute;
  right: 8px;
  border: 0;
  background: transparent;
  color: #5c6a62;
  padding: 4px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
}
.login-eye-btn:hover {
  background: #eef3ef;
  color: #184234;
}
.login-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: #fef1f1;
  border: 1px solid #f6c7c7;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
}
.login-submit {
  width: 100%;
  justify-content: center;
  padding: 11px 16px;
  font-size: 14px;
}
.login-hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f6f8f6;
  border: 1px dashed #cfd8d1;
  font-size: 11.5px;
  color: #4f5d54;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-hint code {
  background: #e6efe8;
  color: #14392c;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

/* Staff Management in Settings */
.staff-current-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f3f8f4;
  border: 1px solid #d5e5da;
}
.staff-current-bar strong {
  display: block;
  font-size: 13.5px;
  color: #163a2e;
}
.staff-current-bar small {
  font-size: 11.5px;
  color: #56645c;
}
.staff-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.staff-role-badge.admin { background: #e6f4ea; color: #166534; }
.staff-role-badge.accountant { background: #edf3fe; color: #1d4ed8; }
.staff-role-badge.staff { background: #fef3eb; color: #c2410c; }
.staff-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.staff-status-pill.active { background: #dcfce7; color: #166534; }
.staff-status-pill.inactive { background: #fee2e2; color: #b91c1c; }
.staff-you-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e8f3ec;
  color: #184234;
  font-size: 10.5px;
  font-weight: 700;
}
.login-history-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fafbfa;
  border: 1px solid #e6ebe6;
}
.login-history-title {
  font-size: 12px;
  font-weight: 700;
  color: #3e4e44;
  margin-bottom: 8px;
}
.login-history-list {
  display: grid;
  gap: 5px;
}
.login-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: #4f5e55;
}

@media (max-width: 1100px) {
  .sidebar { width: 224px; flex-basis: 224px; }
  .topbar { padding: 0 24px; }
  .page-wrap { padding: 24px 24px 20px; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .doc-type-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-strip { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 15; inset: 0 auto 0 0; width: 256px; overflow-y: auto; overscroll-behavior: contain; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 10px 0 30px #14221a20; }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; flex: 0 0 36px; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 15; inset: 0 auto 0 0; width: 256px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 10px 0 30px #14221a20; }
  .sidebar.open { transform: translateX(0); }
  .topbar { height: 58px; padding: 0 16px; gap: 8px; }
  .mobile-menu { display: inline-grid; flex: 0 0 34px; }
  .breadcrumbs { flex: 1; gap: 6px; font-size: 11px; overflow: hidden; white-space: nowrap; }
  .topbar-actions { gap: 6px; }
  .search-box { width: 34px; border: 0; padding: 0 8px; background: transparent; }
  .search-box input { width: 0; padding: 0; }
  .search-box:focus-within { position: absolute; z-index: 3; left: 56px; right: 132px; width: auto; border: 1px solid var(--line); background: white; }
  .search-box:focus-within input { width: 100%; }
  .top-add { width: 36px; padding: 0; }
  .top-add span:last-child { display: none; }
  .notification-button { display: none; }
  .page-wrap { padding: 20px 16px 18px; }
  .page-heading { align-items: flex-start; gap: 12px; flex-direction: column; }
  h1 { font-size: 22px; }
  .heading-actions { gap: 8px; }
  .dashboard-columns { grid-template-columns: 1fr; }
  .currency-rates { grid-template-columns: repeat(2, 1fr); }
  .modal-backdrop { padding: 10px; }
  .modal-body { padding: 16px; }
  .modal-wide .form-grid { grid-template-columns: 1fr 1fr; }
  .terms-preset-bar { grid-template-columns: 1fr; }
  .save-doc-formats { grid-template-columns: 1fr; }
  .login-card { padding: 20px 16px; }
  .login-logo { width: 225px; }
  .login-quick-users { grid-template-columns: 1fr; }
  .footer-note { flex-wrap: wrap; justify-content: flex-start; gap: 8px 14px; }
  .bar-months { gap: 3px; }
  .bar-month-label { font-size: 9px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 12px; }
  .breadcrumbs { min-width: 0; }
  .breadcrumbs strong:first-child,
  .crumb-separator { display: none; }
  .topbar-actions { gap: 4px; }
  .language-button { padding: 0 8px; }
  .page-wrap { padding: 18px 12px 16px; }
  .heading-actions { width: 100%; flex-wrap: wrap; }
  .heading-actions .button { flex: 1 1 auto; }
  .modal-backdrop { padding: 8px; }
  .modal { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .modal-head { padding: 16px 16px 12px; }
  .modal-body { padding: 14px 14px 18px; }
  .form-grid,
  .modal-wide .form-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .button { flex: 1 1 120px; }
  .table-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-scroll th,
  .table-scroll td { padding-left: 12px; padding-right: 12px; }
  .footer-note > span:nth-child(2) { flex-wrap: wrap; }
}
@media (max-width: 440px) {
  .dashboard-grid { gap: 10px; }
  .metric-card { padding: 14px; min-height: 128px; }
  .metric-value { font-size: 18px; }
  .quick-actions { gap: 9px; }
  .quick-action { padding: 11px 10px; gap: 9px; }
  .panel-head { padding: 10px 14px; }
}
