:root {
  color-scheme: light;
  --bg: #eef2f4;
  --panel: #ffffff;
  --panel-2: #f6f8f9;
  --text: #0f1720;
  --muted: #5f6b76;
  --line: #d7dee3;
  --brand: #0f766e;
  --brand-2: #134e4a;
  --accent: #f97316;
  --accent-soft: #fff1e8;
  --danger: #b42318;
  --ok: #0f7a42;
  --shadow: 0 14px 40px rgba(15, 23, 32, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: #0b1220;
  --sidebar-2: #101a2f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.08), transparent 24%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

textarea,
input,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

textarea:focus,
input:focus,
select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--brand);
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #f5f7fa;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.compact-brand {
  border-bottom: 0;
  padding-bottom: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), #14b8a6);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  letter-spacing: 0;
  font-size: 14px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background 0.15s ease, transform 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(1px);
}

.nav-item.active {
  background: rgba(19, 78, 74, 0.9);
}

.nav-item small {
  color: rgba(245, 247, 250, 0.6);
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  color: rgba(245, 247, 250, 0.72);
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 14px;
  max-width: 1680px;
  margin: 0 auto;
}

.topbar,
.hero,
.metric-grid,
.workspace,
.module-grid,
.footer-band {
  width: 100%;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.topbar-left,
.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-month-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-month-controls label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-month-controls select {
  min-width: 78px;
  border: 0;
  padding: 2px 18px 2px 4px;
  background: transparent;
  color: var(--text);
}

.topbar-section-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px;
}

.topbar-section-main,
.topbar-subpage-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-section-main {
  min-width: 0;
}

.topbar-section-month {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.topbar-subpage-nav {
  justify-content: flex-end;
  margin-left: auto;
}

.topbar-section-nav button {
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 8px 11px;
  font-weight: 650;
}

.topbar-section-nav button.active {
  background: var(--sidebar);
  color: white;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 12px;
  color: var(--muted);
}

.pill strong {
  color: var(--text);
}

.btn {
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--sidebar);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.compact {
  padding: 8px 10px;
  font-size: 12px;
  min-height: 34px;
}

.btn.brand {
  background: linear-gradient(135deg, var(--brand), #14b8a6);
  border-bottom: 0;
  padding: 10px 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.hero h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 138px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(215, 222, 227, 0.9);
  box-shadow: var(--shadow);
}

.module-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 10px;
}

.module-card {
  min-height: 148px;
  border: 1px solid rgba(215, 222, 227, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.module-card:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.45);
}

.module-card.active {
  background: linear-gradient(180deg, #ffffff, #effaf8);
  border-color: var(--brand);
}

.module-card-main {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.module-card-top,
.module-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.module-kicker,
.module-footer > span {
  color: var(--muted);
  font-size: 11px;
}

.module-count {
  color: var(--brand-2);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.module-card h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.module-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.module-alert {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  border: 1px solid rgba(249, 115, 22, 0.34);
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.module-alert.ok {
  border-color: rgba(15, 122, 66, 0.24);
  background: #f0fdf4;
  color: var(--ok);
}

.module-footer {
  align-items: flex-end;
}

.module-subtabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.module-subtab,
.module-detail-tab {
  border: 1px solid #dce4e8;
  border-radius: 999px;
  background: #f8fafb;
  color: #52616d;
  font-size: 10px;
  line-height: 1;
  padding: 4px 6px;
}

.module-subtab.active,
.module-detail-tab.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.1);
  color: var(--brand-2);
  font-weight: 700;
}

.module-detail-head {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(215, 222, 227, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.module-detail-head h2 {
  margin: 0;
  font-size: 20px;
}

.module-detail-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.module-detail-tab {
  font-size: 12px;
  padding: 8px 10px;
}

.meta-chip span {
  color: var(--muted);
  font-size: 12px;
}

.meta-chip strong {
  font-size: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(215, 222, 227, 0.92);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric .label {
  color: var(--muted);
  font-size: 12px;
}

.metric .value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}

.metric .hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.workspace.module-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.home-command {
  width: 100%;
}

.date-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.clock-calendar {
  display: grid;
  gap: 8px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-cell {
  position: relative;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 4px;
  text-align: left;
}

.calendar-cell.empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.calendar-cell.selected {
  border-color: var(--brand);
  background: #effaf8;
}

.calendar-cell.has-leave .calendar-day {
  color: var(--danger);
  font-weight: 800;
}

.calendar-day {
  font-weight: 700;
}

.calendar-meta {
  color: var(--muted);
  font-size: 11px;
}

.calendar-leave,
.calendar-alert {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.calendar-leave {
  background: #fee4e2;
  color: var(--danger);
}

.calendar-alert {
  right: 30px;
  background: var(--accent-soft);
  color: var(--accent);
}

.revenue-calendar {
  margin-top: 14px;
}

.revenue-calendar .calendar-cell {
  min-height: 126px;
  cursor: default;
}

.revenue-calendar .calendar-cell.has-revenue {
  border-color: rgba(15, 118, 110, 0.26);
  background: #ffffff;
}

.revenue-calendar .calendar-cell.has-complaint,
.revenue-calendar .calendar-cell.has-ng {
  border-color: rgba(180, 35, 24, 0.36);
}

.revenue-line,
.revenue-flag,
.revenue-ng {
  display: block;
  font-size: 12px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.revenue-line {
  color: #26323a;
}

.revenue-flag,
.revenue-ng {
  color: var(--danger);
  font-weight: 700;
}

.tax-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.26fr) minmax(180px, 0.26fr);
  gap: 12px;
  align-items: stretch;
}

.tax-hero h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

.tax-hero p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tax-highlight {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 4px;
  box-shadow: var(--shadow);
}

.tax-highlight.emphasis {
  border-color: rgba(15, 118, 110, 0.36);
  background: #effaf8;
}

.tax-highlight span,
.tax-highlight small {
  color: var(--muted);
}

.tax-highlight strong {
  font-size: 25px;
  line-height: 1.15;
}

.tax-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tax-form-wide {
  grid-column: 1 / -1;
}

.tax-form textarea {
  min-height: 90px;
  resize: vertical;
}

.watch-list {
  display: grid;
  gap: 8px;
}

.watch-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfc;
  padding: 10px 12px;
  color: #26323a;
}

.business-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.business-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.business-card.attention,
.business-card.danger {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff8f7;
}

.business-card.growth {
  border-color: rgba(15, 122, 66, 0.26);
  background: #f3fbf6;
}

.business-card-title {
  color: var(--muted);
  font-size: 12px;
}

.business-card strong {
  font-size: 20px;
  line-height: 1.15;
}

.business-card p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.finance-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.finance-form-wide {
  grid-column: 1 / -1;
}

.clearance-entry-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.clearance-entry-form .finance-form-wide,
.expense-entry-form .finance-form-wide {
  grid-column: span 2;
}

.expense-entry-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.attendance-action-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attendance-action-form .finance-form-wide {
  grid-column: span 2;
}

.product-search-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-search-form .finance-form-wide {
  grid-column: span 2;
}

.product-search-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.product-actions {
  min-width: 260px;
  justify-content: flex-start;
}

.product-actions .template {
  padding: 6px 9px;
  font-size: 12px;
}

.staff-leave-quick {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfc;
}

.file-upload-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 700;
}

.file-upload-btn input {
  display: none;
}

.file-upload-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tax-file-link {
  margin-top: 12px;
  width: fit-content;
}

.expense-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.expense-month-summary {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr minmax(180px, 240px);
  gap: 12px;
  align-items: stretch;
}

.expense-month-summary > div,
.expense-chip {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.expense-month-summary > div {
  padding: 12px;
}

.expense-month-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.expense-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.expense-chip-grid.month-total {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.expense-subtitle {
  margin-top: 4px;
}

.expense-chip {
  padding: 10px;
  display: grid;
  gap: 4px;
}

.expense-chip span {
  margin: 0;
}

.expense-chip strong,
.expense-planned-note strong {
  font-size: 18px;
  line-height: 1.15;
}

.expense-chip em,
.expense-planned-note em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.expense-planned-note {
  display: grid;
  align-content: start;
  gap: 5px;
}

.expense-calendar-block {
  display: grid;
  gap: 10px;
}

.panel-header.compact {
  margin-bottom: 0;
}

.expense-calendar .calendar-cell {
  min-height: 112px;
}

.calendar-meta.planned {
  color: var(--accent);
  font-weight: 700;
}

.staff-form-shell {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 24px;
}

.staff-form-card {
  width: min(100%, 760px);
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 18px;
}

.staff-form-head {
  display: grid;
  gap: 6px;
}

.staff-form-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.staff-form-head p {
  margin: 0;
  color: var(--muted);
}

.staff-clearance-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.staff-clearance-form .field-wide {
  grid-column: span 2;
}

.staff-clearance-form .form-actions {
  display: grid;
  align-items: end;
}

.staff-form-message {
  min-height: 22px;
  color: var(--muted);
}

.staff-form-message.ok {
  color: var(--ok);
}

.staff-form-message.error {
  color: var(--danger);
}

.supplier-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.outlet-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inline-status-head {
  margin: 14px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
}

.inline-status-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.inline-status-head span {
  font-size: 12px;
}

.supplier-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 10px;
  display: grid;
  gap: 7px;
}

.supplier-card.attention {
  border-color: rgba(249, 115, 22, 0.32);
  background: #fffaf6;
}

.supplier-card-head,
.supplier-card-lines {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.supplier-card-head span,
.supplier-card-lines {
  color: var(--muted);
  font-size: 12px;
}

.supplier-card-main {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.clearance-hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
}

.clearance-hero-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 16px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow);
}

.clearance-hero-card.primary {
  border-color: rgba(15, 118, 110, 0.35);
  background: #effaf8;
}

.clearance-hero-card span,
.clearance-hero-card p {
  color: var(--muted);
}

.clearance-hero-card strong {
  font-size: 42px;
  line-height: 1;
}

.clearance-hero-card p {
  margin: 0;
}

.clock-adjust {
  display: grid;
  gap: 10px;
}

.summary-box.small {
  padding: 10px;
  font-size: 12px;
}

.module-area {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(215, 222, 227, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.bars {
  display: grid;
  gap: 10px;
}

.bar {
  display: grid;
  gap: 5px;
}

.bar-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e7ecef;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #7dd3fc);
}

.quick-grid {
  display: grid;
  gap: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.info-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.info-label {
  color: var(--muted);
  font-size: 12px;
}

.info-card strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.info-card p {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.command-template-list {
  display: grid;
  gap: 8px;
}

.command-template-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfc;
  padding: 8px;
}

.command-template-line strong {
  font-size: 12px;
}

.command-template-line code {
  white-space: pre-wrap;
  overflow: auto;
  color: #1f2a33;
  font-size: 12px;
  line-height: 1.45;
}

.template {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.template.danger {
  border-color: rgba(180, 35, 24, 0.3);
  color: var(--danger);
}

.template.active {
  border-color: var(--brand);
  background: rgba(15, 118, 110, 0.08);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

.clearance-active-table table {
  table-layout: fixed;
  min-width: 1120px;
}

.clearance-active-table th,
.clearance-active-table td {
  text-align: center;
  vertical-align: middle;
}

.clearance-active-table th:nth-child(1),
.clearance-active-table td:nth-child(1) {
  width: 78px;
}

.clearance-active-table th:nth-child(2),
.clearance-active-table td:nth-child(2) {
  width: 150px;
  text-align: left;
}

.clearance-active-table th:nth-child(9),
.clearance-active-table td:nth-child(9) {
  width: 190px;
}

.clearance-active-table .template {
  white-space: nowrap;
}

.clearance-chart {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px;
  align-items: center;
}

.clearance-compare-grid {
  margin-bottom: 12px;
}

.clearance-pie {
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.clearance-pie > div {
  width: 48%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.clearance-pie strong {
  font-size: 28px;
  line-height: 1;
}

.clearance-pie span {
  color: var(--muted);
  font-size: 12px;
}

.clearance-chart-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.clearance-chart-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 6px;
}

.clearance-chart-item i {
  width: 22px;
  height: 5px;
  border-radius: 999px;
}

.clearance-chart-item span {
  color: var(--muted);
  font-size: 12px;
}

.clearance-chart-item strong {
  font-size: 20px;
}

.command-box {
  display: grid;
  gap: 10px;
}

.command-box textarea {
  min-height: 132px;
  resize: vertical;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

.tab.active {
  background: var(--sidebar);
  color: white;
  border-color: var(--sidebar);
}

.section {
  display: none;
}

.section.active {
  display: grid;
  gap: 14px;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.section-grid.one {
  grid-template-columns: minmax(0, 1fr);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e7ecef;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  line-height: 1.35;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
}

th:empty {
  width: 76px;
}

.table-wrap .template {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.1;
}

tbody tr:hover {
  background: rgba(15, 118, 110, 0.04);
}

tfoot td {
  position: sticky;
  bottom: 0;
  background: #f8fafb;
  border-top: 1px solid var(--line);
  font-weight: 800;
}

.revenue-sheet {
  margin-top: 14px;
}

.revenue-sheet table {
  min-width: 1420px;
}

.revenue-sheet .empty-day td {
  color: #a2adb7;
  background: #fbfcfc;
}

.summary-box {
  background: linear-gradient(180deg, #fbfcfc, #f6f8f9);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  white-space: pre-wrap;
  color: #26323a;
}

.command-example {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

.command-example-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.feed {
  display: grid;
  gap: 10px;
}

.feed-item {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid #edf1f3;
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-item .meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.feed-item strong {
  font-size: 13px;
}

.architecture {
  display: grid;
  gap: 12px;
}

.architecture-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.architecture-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.architecture-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.architecture-card p {
  margin: 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #0b1220;
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: min(420px, calc(100vw - 32px));
  display: none;
}

.toast.show {
  display: block;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.embedded-workflow {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.link-list {
  display: grid;
  gap: 10px;
}

.link-card {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.link-card:hover {
  border-color: rgba(15, 118, 110, 0.45);
}

.link-card strong {
  font-size: 14px;
}

.link-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.copy-textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  background: #f8fafb;
  color: var(--text);
  line-height: 1.6;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace,
  .section-grid,
  .info-grid,
  .tax-hero,
  .business-card-grid,
  .supplier-card-grid,
  .outlet-card-grid,
  .clearance-chart,
  .clearance-hero-grid,
  .architecture-grid,
  .guide-row {
    grid-template-columns: 1fr;
  }

  .module-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    justify-content: flex-start;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-section-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-subpage-nav {
    justify-content: flex-start;
    margin-left: 0;
  }

  .command-grid {
    grid-template-columns: 1fr;
  }

  .command-template-line {
    grid-template-columns: 1fr auto auto;
  }

  .command-template-line code {
    grid-column: 1 / -1;
  }

  .date-switcher {
    grid-template-columns: 1fr;
  }

  .tax-form {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .finance-form {
    grid-template-columns: 1fr;
  }

  .clearance-entry-form .finance-form-wide {
    grid-column: 1;
  }

  .expense-entry-form .finance-form-wide {
    grid-column: 1;
  }

  .attendance-action-form .finance-form-wide {
    grid-column: 1;
  }

  .expense-month-summary,
  .expense-chip-grid {
    grid-template-columns: 1fr;
  }

  .staff-form-shell {
    padding: 14px;
  }

  .staff-form-card {
    margin-top: 0;
    padding: 16px;
  }

  .staff-clearance-form {
    grid-template-columns: 1fr;
  }

  .staff-clearance-form .field-wide {
    grid-column: 1;
  }

  .calendar-cell {
    min-height: 58px;
    padding: 6px;
  }

  .revenue-calendar .calendar-cell {
    min-height: 106px;
  }

  .module-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-card {
    min-height: 142px;
  }

  .module-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .module-detail-tabs {
    justify-content: flex-start;
  }

  .embedded-workflow {
    min-height: 680px;
  }
}
