:root {
  --app-bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --line: #e2e8f0;
  --accent: #0e7490;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.dark {
  --app-bg: #10141b;
  --panel: #161d27;
  --panel-soft: #1c2532;
  --text-main: #e5edf6;
  --text-muted: #9aa8b8;
  --text-faint: #728195;
  --line: #263244;
  --accent: #22d3ee;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; }
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-faint) 42%, transparent) transparent;
}
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-faint) 36%, transparent);
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-faint) 56%, transparent);
}

.hero-panel {
  background:
    linear-gradient(135deg, rgba(8, 51, 68, .96), rgba(15, 23, 42, .96)),
    radial-gradient(circle at 25% 20%, rgba(34, 211, 238, .24), transparent 32%);
}

.metric-glass {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  background: rgba(255, 255, 255, .09);
  padding: 16px;
}
.metric-glass span { display: block; font-size: 12px; color: rgba(255, 255, 255, .7); }
.metric-glass strong { margin-top: 8px; display: block; font-size: 20px; font-weight: 700; }

.login-card,
.card,
.modal-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-main);
  box-shadow: var(--shadow);
}
.login-card { border-radius: 20px; padding: 32px; }
.card { border-radius: 12px; }

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.form-input,
.form-select,
.form-textarea,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text-main);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.form-input,
.form-select { height: 42px; padding: 0 12px; }
.form-textarea { min-height: 96px; padding: 10px 12px; resize: vertical; }
.search-input { height: 42px; padding: 0 12px 0 38px; }
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 288px;
  overflow-y: auto;
  transform: translateX(-100%);
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-main);
  transition: transform .22s ease;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(15, 23, 42, .36);
  backdrop-filter: blur(2px);
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-faint) 22%, transparent);
}
.sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); }
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease;
}
.nav-link:hover,
.nav-link.active {
  background: rgba(14, 116, 144, .1);
  color: var(--text-main);
}
.nav-parent {
  margin-top: 2px;
}
.nav-children {
  margin: 3px 0 8px 14px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
}
.nav-children.is-collapsed { display: none; }
.nav-child {
  min-height: 34px;
  font-size: 12.5px;
}
.nav-section {
  padding: 14px 12px 5px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  padding: 0 16px;
  backdrop-filter: blur(16px);
}
@media (min-width: 640px) {
  .topbar { padding: 0 24px; }
}

.icon-button {
  display: inline-grid;
  height: 42px;
  width: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-main);
  transition: background .18s ease, border-color .18s ease;
}
.icon-button:hover { background: var(--panel-soft); }
.notification-topbar {
  position: relative;
}
.notification-toggle {
  position: relative;
}
.notification-count {
  position: absolute;
  right: -5px;
  top: -6px;
  min-width: 19px;
  border: 2px solid var(--panel);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 15px;
  padding: 0 4px;
}
.notification-dropdown {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 45;
  width: min(380px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.notification-dropdown.hidden { display: none; }
.notification-dropdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}
.notification-dropdown-head span,
.notification-mini em,
.notification-mini small {
  color: var(--text-muted);
  font-size: 12px;
  font-style: normal;
}
.notification-dropdown-list {
  max-height: 420px;
  overflow-y: auto;
}
.notification-mini {
  display: grid;
  width: 100%;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
}
.notification-mini:hover {
  background: var(--panel-soft);
}
.notification-mini.unread {
  box-shadow: 3px 0 0 var(--accent) inset;
}
.notification-mini-icon {
  display: grid;
  height: 34px;
  width: 34px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.notification-mini strong,
.notification-mini small {
  display: block;
}
.notification-mini strong {
  font-size: 13px;
}
.notification-all,
.notification-empty {
  display: block;
  width: 100%;
  padding: 12px 14px;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}
.profile-chip {
  display: inline-flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 0 10px 0 5px;
}

.shortcut-panel {
  position: fixed;
  top: 74px;
  left: 16px;
  z-index: 35;
  pointer-events: none;
  background: transparent;
  padding: 0;
}
.shortcut-panel.hidden { display: none; }
.shortcut-inner {
  pointer-events: auto;
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}
@media (min-width: 1024px) {
  .shortcut-panel { left: 312px; }
}
@media (max-width: 639px) {
  .shortcut-panel { left: 8px; padding: 8px 0; }
  .shortcut-inner { max-width: none; }
}
.shortcut-item {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.shortcut-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--panel-soft) 80%, var(--accent) 8%);
}
.shortcut-icon {
  display: grid;
  height: 38px;
  width: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: rgba(14, 116, 144, .1);
  color: var(--accent);
}

.stat-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 18px;
}
.stat-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  height: 40px;
  width: 40px;
  place-items: center;
  border-radius: 10px;
}
.stat-icon svg {
  height: 18px;
  width: 18px;
}
.stat-icon.cyan { background: rgba(14, 116, 144, .11); color: var(--accent); }
.stat-icon.green { background: rgba(21, 128, 61, .11); color: var(--success); }
.stat-icon.amber { background: rgba(180, 83, 9, .12); color: var(--warning); }
.stat-icon.red { background: rgba(185, 28, 28, .11); color: var(--danger); }
.stat-card > p,
.stat-card > strong {
  padding-right: 46px;
}
.stat-card .icon-wrap {
  display: grid;
  height: 40px;
  width: 40px;
  place-items: center;
  border-radius: 10px;
}

.soft-table { width: 100%; border-collapse: collapse; }
.soft-table.stable-table { table-layout: fixed; min-width: 920px; }
.soft-table th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}
.soft-table th,
.soft-table td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  vertical-align: middle;
}
.soft-table.stable-table th,
.soft-table.stable-table td { overflow-wrap: anywhere; }
.soft-table tr:last-child td { border-bottom: 0; }
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 10px;
}
.table-search,
.table-select {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-main);
  outline: none;
}
.table-search { padding: 0 12px 0 38px; }
.table-select {
  max-width: 260px;
  padding: 0 12px;
}
.table-select.compact { max-width: 150px; }
.table-toolbar .table-select.compact {
  flex: 0 0 150px;
}
.table-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  font: inherit;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.detail-row:last-child { border-bottom: 0; }
.detail-row span {
  color: var(--text-muted);
  font-size: 13px;
}
.detail-row strong {
  text-align: right;
  font-size: 13px;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.icon-action {
  display: inline-grid;
  height: 28px;
  width: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text-main);
}
.icon-action svg {
  height: 14px;
  width: 14px;
  stroke-width: 2.2;
}
.icon-action:hover { background: var(--panel-soft); }
.icon-action.danger { color: var(--danger); }
.row-actions .action-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}
.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inline-form {
  display: inline-flex;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}
.table-count-bottom {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.table-page-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.action-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 4px;
}
.segmented button {
  min-height: 36px;
  border-radius: 9px;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}
.segmented button.active {
  background: var(--panel);
  color: var(--text-main);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}
.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 14px;
  min-height: 220px;
  align-items: end;
}
.chart-month {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.chart-pair {
  display: flex;
  align-items: end;
  gap: 5px;
  height: 170px;
}
.chart-pair span {
  display: block;
  width: 13px;
  border-radius: 999px 999px 4px 4px;
}
.chart-pair .income { background: #22c55e; }
.chart-pair .expense { background: #f59e0b; }
.chart-month small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.donut-chart {
  display: grid;
  height: 190px;
  width: 190px;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(#22c55e 0 42%, #06b6d4 42% 62%, #f59e0b 62% 100%);
  position: relative;
}
.donut-chart::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: inherit;
  background: var(--panel);
}
.donut-chart span {
  position: relative;
  z-index: 1;
  text-align: center;
  font-weight: 800;
}
.legend-dot {
  display: inline-block;
  height: 10px;
  width: 10px;
  border-radius: 999px;
}
.legend-dot.green { background: #22c55e; }
.legend-dot.cyan { background: #06b6d4; }
.legend-dot.amber { background: #f59e0b; }

.timeline-item,
.note-strip,
.mini-panel,
.taxonomy-row,
.invoice-preview,
.notification-item,
.template-item,
.definition-card,
.rule-row,
.agenda-item,
.backup-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text-main);
}
.timeline-item,
.note-strip,
.mini-panel,
.invoice-preview {
  display: grid;
  gap: 5px;
  padding: 13px;
}
.timeline-item span,
.note-strip span,
.mini-panel span,
.invoice-preview span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.note-strip.warning {
  border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
  background: color-mix(in srgb, var(--panel-soft) 82%, var(--warning) 8%);
}
.taxonomy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.taxonomy-row strong {
  color: var(--text-muted);
  font-size: 12px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 8px;
}
.calendar-grid strong,
.calendar-grid span {
  display: grid;
  min-height: 52px;
  place-items: center;
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text-muted);
  font-weight: 800;
}
.calendar-grid strong {
  min-height: 34px;
  background: transparent;
  color: var(--text-faint);
  font-size: 12px;
}
.calendar-grid .today {
  background: #0e7490;
  color: white;
}
.calendar-grid .has-event {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  color: var(--text-main);
}
.notes-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.note-card {
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, #22c55e 12%);
  padding: 18px;
}
.note-card.amber { background: color-mix(in srgb, var(--panel) 88%, #f59e0b 12%); }
.note-card.cyan { background: color-mix(in srgb, var(--panel) 88%, #06b6d4 12%); }
.note-card span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.note-card h3 {
  margin-top: 18px;
  font-weight: 800;
}
.note-card p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
}
.notification-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}
.notification-item.unread {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}
.notification-item p {
  color: var(--text-muted);
  font-size: 13px;
}
.notification-item > span {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
}
.template-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  font-weight: 800;
}
.template-item span {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
}
.template-item.active {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--panel-soft) 78%, var(--accent) 8%);
}
.definition-card,
.agenda-item,
.backup-row,
.rule-row {
  padding: 14px;
}
.definition-card {
  display: grid;
  gap: 8px;
}
.definition-card span,
.definition-card small,
.agenda-item small,
.backup-row span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.definition-card strong {
  font-size: 22px;
}
.rule-row,
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-shell {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) 320px;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.calendar-header h3 {
  font-size: 20px;
  font-weight: 800;
}
.calendar-header span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.calendar-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
  gap: 8px;
  overflow-x: auto;
}
.calendar-board strong,
.calendar-board span {
  border-radius: 12px;
  padding: 10px;
}
.calendar-board strong {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}
.calendar-board span {
  min-height: 94px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text-main);
  font-weight: 800;
}
.calendar-board span em {
  display: block;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(14, 116, 144, .12);
  padding: 4px 7px;
  color: var(--accent);
  font-size: 11px;
  font-style: normal;
}
.calendar-board .muted {
  color: var(--text-faint);
  opacity: .65;
}
.calendar-board .today {
  border-color: transparent;
  background: #0e7490;
  color: #fff;
}
.calendar-board .today em {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}
.calendar-board .danger em {
  background: rgba(185, 28, 28, .12);
  color: var(--danger);
}
.notes-list {
  display: grid;
  gap: 14px;
}
.note-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 18px;
}
.note-panel h3 {
  margin-top: 12px;
  font-weight: 800;
}
.note-panel p,
.note-panel small {
  color: var(--text-muted);
  font-size: 13px;
}
.permission-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}
.permission-grid span {
  color: var(--text-muted);
}
.invoice-document {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 28px;
  color: var(--text-main);
  box-shadow: var(--shadow);
}
.invoice-head,
.invoice-parties {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.invoice-head span,
.invoice-parties span,
.invoice-parties small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.invoice-parties {
  margin-top: 18px;
}
.invoice-total {
  margin: 22px 0 0 auto;
  max-width: 320px;
}
.template-editor {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}
.template-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
}
.template-tokens {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.template-tokens span {
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.template-preview {
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-soft) 86%, var(--accent) 6%);
  padding: 16px;
}
.template-preview strong {
  display: block;
  margin-bottom: 10px;
}
.template-preview p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}
.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  font-weight: 800;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px 14px;
  font-weight: 800;
}
.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-row i {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-faint) 30%, transparent);
  transition: background .18s ease;
}
.switch-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  height: 20px;
  width: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .18);
  transition: transform .18s ease;
}
.switch-row input:checked + i {
  background: #0e7490;
}
.switch-row input:checked + i::after {
  transform: translateX(20px);
}
.permission-picker {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.permission-picker .switch-row {
  padding: 10px 12px;
  font-size: 13px;
}
.permission-picker .switch-row i {
  width: 40px;
  height: 22px;
}
.permission-picker .switch-row i::after {
  top: 3px;
  height: 16px;
  width: 16px;
}
.permission-picker .switch-row input:checked + i::after {
  transform: translateX(18px);
}
.notes-table td:nth-child(3) {
  min-width: 320px;
  white-space: normal;
}
[id^="customer-"][id$="-tab"],
[id^="supplier-"][id$="-tab"] {
  min-height: 330px;
}
.customer-detail-layout {
  grid-template-columns: minmax(340px, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
}
.customer-detail-layout > .card {
  min-width: 0;
}
.customer-detail-layout .soft-table {
  min-width: 680px;
}
#customer-sales-tab,
#customer-payments-tab,
#customer-notes-tab {
  min-height: 380px;
}
#customer-sales-tab .table-toolbar,
#customer-payments-tab .table-toolbar {
  min-height: 62px;
}
#customer-notes-tab {
  align-content: start;
}
@media (max-width: 1023px) {
  .customer-detail-layout {
    grid-template-columns: 1fr;
  }
  .customer-detail-layout .soft-table {
    min-width: 640px;
  }
}
.backup-list {
  display: grid;
  gap: 10px;
}
@media (max-width: 1023px) {
  .calendar-shell,
  .template-editor {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 639px) {
  .table-pager {
    align-items: flex-start;
    flex-direction: column;
  }
  .note-panel,
  .invoice-head,
  .invoice-parties {
    display: grid;
  }
  .permission-grid {
    grid-template-columns: 1fr;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}
.badge.green { background: rgba(21, 128, 61, .11); color: var(--success); }
.badge.amber { background: rgba(180, 83, 9, .13); color: var(--warning); }
.badge.red { background: rgba(185, 28, 28, .12); color: var(--danger); }
.badge.cyan { background: rgba(14, 116, 144, .12); color: var(--accent); }

.flash-message {
  position: relative;
  margin-bottom: 20px;
  border-radius: 12px;
  padding: 12px 42px 12px 16px;
  font-size: 14px;
  font-weight: 700;
  transition: opacity .22s ease, transform .22s ease;
}
.flash-message.is-hiding { opacity: 0; transform: translateY(-4px); }
.flash-close {
  position: absolute;
  right: 12px;
  top: 50%;
  height: 24px;
  width: 24px;
  transform: translateY(-50%);
  border-radius: 999px;
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}
.flash-message.success {
  border: 1px solid rgba(21, 128, 61, .26);
  background: rgba(220, 252, 231, .86);
  color: #14532d;
}
.dark .flash-message.success {
  border-color: rgba(34, 197, 94, .28);
  background: rgba(21, 128, 61, .16);
  color: #bbf7d0;
}

.cell-truncate {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.permissions-pending [data-page] {
  visibility: hidden;
}

.permissions-pending [data-page-section] {
  display: none !important;
}

.aketa-ready [data-page] {
  visibility: visible;
}

.global-search-heading {
  padding: 10px 14px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.action-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 13px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 700;
}
.action-button.primary {
  border-color: transparent;
  background: #0e7490;
  color: white;
}
.action-button.danger-soft {
  border-color: rgba(185, 28, 28, .22);
  background: rgba(185, 28, 28, .08);
  color: var(--danger);
}
.action-button.danger {
  border-color: rgba(185, 28, 28, .28);
  background: #b91c1c;
  color: white;
}
.action-button.compact {
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}

.global-search-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  max-height: min(420px, calc(100vh - 92px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 8px;
}
.global-search-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  color: var(--text-main);
}
.global-search-item:hover { background: var(--panel-soft); }
.global-search-item i { height: 18px; width: 18px; color: var(--accent); }
.global-search-item span { display: block; font-size: 12px; color: var(--text-muted); }

.tab-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
  transition: .18s ease;
}

.tab-button:hover {
  color: var(--text-main);
  background: var(--panel-soft);
}

.tab-button.active {
  border-color: var(--line);
  border-bottom-color: var(--panel);
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 -1px 0 var(--accent) inset;
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 18px;
}

.notification-preference-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.notification-preference-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px;
}

.notification-preference-card h4 {
  font-size: 15px;
  font-weight: 800;
}

.notification-preference-card p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.notification-channel-switches {
  display: grid;
  gap: 10px;
}

.security-protocol-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.security-protocol-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 16px;
}

.security-protocol-card h4 {
  font-size: 15px;
  font-weight: 700;
}

.security-protocol-card p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.security-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.security-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.security-switch i {
  position: relative;
  display: block;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--line);
  transition: .2s ease;
}

.security-switch i::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgb(15 23 42 / .24);
  transition: .2s ease;
}

.security-switch input:checked + i { background: var(--accent); }
.security-switch input:checked + i::after { transform: translateX(20px); }
.security-switch.is-locked { cursor: not-allowed; opacity: .78; }

.ban-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 12px;
}

.ban-row strong {
  display: block;
  font-size: 14px;
}

.ban-row span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.feature-tile,
.image-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 16px;
}
.feature-tile {
  min-height: 150px;
}
.feature-tile i {
  height: 24px;
  width: 24px;
  color: var(--accent);
}
.feature-tile strong,
.feature-tile span {
  display: block;
}
.feature-tile strong { margin-top: 14px; }
.feature-tile span {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}
.image-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.image-tile {
  display: grid;
  min-height: 132px;
  align-content: center;
  gap: 8px;
}
.image-tile span {
  display: grid;
  height: 42px;
  width: 42px;
  place-items: center;
  border-radius: 10px;
  background: rgba(14, 116, 144, .12);
  color: var(--accent);
  font-weight: 800;
}
.image-tile.primary { border-color: rgba(14, 116, 144, .38); }
.image-tile.empty {
  border-style: dashed;
  color: var(--text-muted);
}
.image-tile small {
  color: var(--text-muted);
}

.logo-picker {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}
.logo-picker button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text-main);
  font-weight: 700;
}

.assistant-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel) 86%, #0e7490 14%), var(--panel));
  box-shadow: var(--shadow);
  padding: 20px;
}
.assistant-card h3 {
  font-size: 18px;
  font-weight: 700;
}
.assistant-card p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}
.assistant-input {
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}
.assistant-input > i {
  height: 24px;
  width: 24px;
  color: var(--accent);
}
.calendar-list {
  display: grid;
  gap: 12px;
}
.calendar-list.hidden { display: none; }

@media (max-width: 639px) {
  .assistant-input {
    grid-template-columns: 1fr;
  }
  .assistant-input > i {
    display: none;
  }
  .global-search-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 76px;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, .55);
  padding: 18px;
}
.modal-overlay:not(.hidden) { display: flex; }
.modal-panel {
  max-height: min(760px, calc(100vh - 36px));
  width: min(620px, 100%);
  overflow: auto;
  border-radius: 16px;
}

.page-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-title h2 {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 750;
  letter-spacing: 0;
}
.page-title p { margin-top: 6px; max-width: 680px; color: var(--text-muted); }

.kanban-column {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px;
}

.calendar-cell {
  min-height: 92px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 10px;
}
