@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f9f9;
  --bg-subtle: #eaf5f5;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #072144;
  --text-secondary: #0d2a4d;
  --muted: #3b6b8a;
  --border: #b8d0e0;
  --border-light: #e3eef3;
  --accent: #01aba8;
  --accent-hover: #00705f;
  --accent-light: #e6f7f6;
  --accent-gradient: linear-gradient(135deg, #01aba8 0%, #00705f 100%);
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --shadow-sm: 0 1px 2px rgba(7, 33, 68, 0.04);
  --shadow: 0 4px 16px rgba(7, 33, 68, 0.06);
  --shadow-lg: 0 12px 32px rgba(7, 33, 68, 0.1);
  --shadow-glow: 0 0 0 3px rgba(1, 171, 168, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --font-display: "Fraunces", serif;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(
      circle at top left,
      rgba(99, 102, 241, 0.07),
      transparent 35%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(139, 92, 246, 0.05),
      transparent 35%
    ),
    var(--bg);
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.taskbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  text-decoration: none;
  padding: 6px 14px 6px 0;
  margin-right: 6px;
  border-right: 1px solid rgba(226, 232, 240, 0.7);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.taskbar-brand:hover {
  transform: translateY(-1px);
}

.taskbar-logo {
  width: 36px;
  height: 36px;
  max-width: 36px;
  max-height: 36px;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: middle;
}

.taskbar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.taskbar-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.taskbar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.8125rem;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease;
  background: transparent;
  border: 1px solid transparent;
}

.taskbar-link:hover {
  color: var(--text);
  background: var(--border-light);
  transform: translateY(-1px);
}

.taskbar-link-active {
  color: #fff;
  background: var(--accent-gradient);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
}

.taskbar-link-active:hover {
  color: #fff;
  background: var(--accent-gradient);
  filter: brightness(1.05);
}

.taskbar-link-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease;
  background: transparent;
  border: 1px solid transparent;
}

.taskbar-link-group:hover {
  color: var(--text);
  background: var(--border-light);
}

.taskbar-link-group-active {
  color: #fff;
  background: var(--accent-gradient);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
}

.taskbar-link-group-active:hover {
  color: #fff;
  background: var(--accent-gradient);
  filter: brightness(1.05);
}

.taskbar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.taskbar-caret {
  font-size: 0.65rem;
  opacity: 0.75;
  margin-left: 2px;
}

.taskbar-spacer {
  display: none;
}

.taskbar-utility {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.taskbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font: inherit;
  font-weight: 500;
  font-size: 0.8125rem;
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.taskbar-user-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(226, 232, 240, 1);
}

.taskbar-fy-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 999px;
  padding: 2px;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  color: var(--text);
}

.taskbar-fy-trigger:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
  border-color: rgba(226, 232, 240, 1);
}

.taskbar-fy-label {
  color: var(--muted);
  font-weight: 600;
  padding: 5px 10px 5px 12px;
  letter-spacing: 0.02em;
  user-select: none;
}

.taskbar-fy-value {
  padding: 5px 28px 5px 10px;
  font-weight: 500;
}

.taskbar-dropdown-wrap {
  position: relative;
}

.taskbar-dropdown-trigger {
  display: inline-flex;
  align-items: center;
}

.taskbar-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow: var(--shadow-lg);
  min-width: 210px;
  max-width: 260px;
  z-index: 200;
  padding: 6px;
  animation: dropIn 180ms ease-out;
}

.taskbar-dropdown-right {
  right: 0;
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.taskbar-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-xs);
  text-decoration: none;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.taskbar-dropdown-item:hover,
.taskbar-dropdown-item-active {
  background: var(--accent-light);
  color: var(--accent);
}

.taskbar-dropdown-item-active {
  font-weight: 600;
}

.taskbar-global-search {
  flex: 1 1 auto;
  padding: 0 12px;
  min-width: 220px;
  max-width: 420px;
}

.global-search {
  width: 100%;
  position: relative;
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.global-search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1, 171, 168, 0.12);
}

.global-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex-shrink: 0;
}

.global-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
}

.global-search-input::placeholder {
  color: #94a3b8;
}

.global-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 999px;
  transition:
    color 0.15s,
    background 0.15s;
}

.global-search-clear:hover {
  color: var(--text);
  background: var(--border-light);
}

.global-search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font:
    500 0.75rem/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(14px) saturate(180%);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-height: 420px;
  overflow-y: auto;
  animation: dropIn 180ms ease-out;
}

.global-search-group {
  padding: 6px;
}

.global-search-group-label {
  padding: 8px 12px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.global-search-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.global-search-item:hover,
.global-search-item-active {
  background: var(--accent-light);
  color: var(--accent);
}

.global-search-item-title {
  font-weight: 600;
  color: var(--text);
}

.global-search-item-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

.global-search-item-description {
  font-size: 0.8rem;
  color: var(--muted);
}

.global-search-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
}

.global-search-view-all {
  width: 100%;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

.global-search-view-all:hover {
  background: var(--accent-light);
}

.global-search-status {
  padding: 16px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.global-search-error {
  padding: 16px;
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 0.875rem;
  text-align: center;
}

.global-search-empty-title {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.global-search-empty-tips {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
  text-align: left;
}

/* ---------- topbar: mobile menu button ---------- */
.taskbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.taskbar-menu-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.taskbar-menu-btn:focus-visible,
.taskbar-user-btn:focus-visible,
.taskbar-fy-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- topbar / shell: responsive ---------- */
@media (max-width: 1024px) {
  .app-topbar {
    padding: 10px 16px;
    gap: 10px;
  }

  .taskbar-global-search {
    max-width: 320px;
  }

  .taskbar-user-btn {
    max-width: 150px;
  }
}

/* Tablets and phones: the search drops onto its own row. */
@media (max-width: 860px) {
  .app-topbar {
    flex-wrap: wrap;
    min-height: 0;
    padding: 8px 14px;
    row-gap: 8px;
  }

  .app-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-topbar-right {
    flex: 0 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .taskbar-menu-btn {
    display: inline-flex;
  }

  .taskbar-global-search {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
    padding: 0 0 4px;
  }

  .global-search-kbd {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-topbar {
    padding: 8px 12px;
  }

  .app-topbar-right {
    gap: 6px;
  }

  .taskbar-brand {
    border-right: 0;
    margin-right: 0;
    padding-right: 0;
  }

  .taskbar-logo {
    width: 32px;
    height: 32px;
    max-width: 32px;
    max-height: 32px;
  }

  /* Keep only the essential signal: FY year, not the "FY" prefix. */
  .taskbar-fy-label {
    display: none;
  }

  .taskbar-fy-value {
    padding: 5px 14px 5px 12px;
  }

  .taskbar-user-name {
    display: none;
  }

  .taskbar-user-btn {
    padding: 6px 8px;
  }
}

@media (max-width: 400px) {
  .taskbar-logo {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
  }

  .taskbar-fy-value {
    padding: 5px 10px;
  }
}

.app-main {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 56px;
}

.welcome-banner-wrap {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 0 28px;
}

.welcome-banner-wrap > * {
  animation: slideDown 240ms ease-out;
}

.welcome-banner-gradient {
  position: relative;
  height: 132px;
  margin: 16px 0 0;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  box-shadow:
    0 24px 40px -26px rgba(5, 11, 30, 0.6),
    0 6px 16px -8px rgba(0, 0, 0, 0.25);
}

.welcome-banner-content-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  margin: 0;
  text-shadow: 0 1px 14px rgba(0, 20, 25, 0.35);
}

.welcome-banner-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: none;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow:
    0 12px 26px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.welcome-banner-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.welcome-banner-greeting {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  opacity: 0.92;
  color: #fff;
}

.welcome-banner-name {
  margin: 3px 0 2px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.welcome-banner-org {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
  color: #fff;
}

.welcome-banner-date {
  position: absolute;
  right: 28px;
  bottom: 16px;
  font-size: 12px;
  opacity: 0.88;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .welcome-banner-gradient {
    height: auto;
    min-height: 124px;
  }
  .welcome-banner-content-wrap {
    position: relative;
    inset: auto;
    min-height: 124px;
    padding: 14px 18px;
    gap: 14px;
  }
  .welcome-banner-avatar {
    width: 56px;
    height: 56px;
  }
  .welcome-banner-name {
    font-size: 21px;
    max-width: 150px;
  }
  .welcome-banner-date {
    display: none;
  }
  .welcome-banner-role {
    right: 16px;
  }
}

.welcome-banner-role {
  position: absolute;
  top: 0;
  right: 28px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 14px 19px;
  background: #ffd166;
  color: #14221c;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.4s;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 8px), 0 100%);
}
.welcome-banner-role[data-role="owner"] {
  background: #ffd166;
}
.welcome-banner-role[data-role="accountant"] {
  background: #5eead4;
}
.welcome-banner-role[data-role="staff"] {
  background: #7dd3fc;
}
.welcome-banner-role[data-role="viewer"] {
  background: #c4b5fd;
}

@media (max-width: 600px) {
  .welcome-banner-role {
    right: 16px;
  }
}

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 300ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-centered {
  max-width: 520px;
  margin: 40px auto;
  width: 100%;
}

.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 16px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  font-family: var(--font-display);
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.page-subtitle a {
  color: var(--accent);
  font-weight: 500;
}

.page-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 6px;
}

.page-breadcrumbs .page-breadcrumb-link {
  font-weight: 500;
}

/* Prominent "back to parent" affordance used by report pages. */
.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  padding: 6px 14px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.page-back-link::before {
  content: "\2190";
  font-size: 0.95rem;
  line-height: 1;
  color: var(--accent);
}

.page-back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateX(-1px);
}

.page-back-link:active {
  transform: translateX(0);
}

.auth-switch {
  margin: 20px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
}

.terms-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.terms-agree input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.terms-agree a {
  color: var(--accent);
  font-weight: 500;
}

.terms-agree a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.policy-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.policy-content h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}

.policy-content p {
  margin: 0 0 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.policy-meta {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.policy-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.policy-table th,
.policy-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.policy-table th {
  font-weight: 600;
  background: var(--bg-subtle);
}

.policy-content ul,
.policy-content ol {
  margin: 0 0 12px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.policy-content li {
  margin: 4px 0;
}

.password-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.password-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 0;
}

.password-toggle:hover {
  color: var(--text);
}

.field-optional {
  font-weight: 400;
  color: var(--muted);
}

.dev-code-hint {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.page-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-actions .btn {
  flex: 0 0 auto;
  justify-content: center;
}

.daily-actions-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
}

.daily-date-picker {
  min-width: 280px;
}

.page-breadcrumb-sep {
  color: var(--border);
  user-select: none;
}

.page-breadcrumb-link {
  color: var(--muted);
  text-decoration: none;
}

.page-breadcrumb-link:hover {
  color: var(--accent);
}

.page-breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 500;
}

.banner-error,
.banner-success {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  animation: slideDown 240ms ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.banner-error {
  color: #991b1b;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
}

.banner-info {
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.temp-password {
  background: #1e3a8a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.08em;
}

.banner-success {
  color: #065f46;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
}

.loading,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 0.9rem;
}

.filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  width: 100%;
}

.search-field--full {
  grid-column: 1 / -1;
}

.search-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.search-field input,
.search-field select,
.search-field textarea {
  width: 100%;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.search-field input:focus,
.search-field select:focus,
.search-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.form-grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: var(--text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #94a3b8;
}

.form-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.fy-selector {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.fy-selector:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.fy-selector-label {
  color: var(--muted);
  font-weight: 600;
  padding: 5px 10px 5px 12px;
  letter-spacing: 0.02em;
  user-select: none;
}

.fy-selector select {
  padding: 5px 28px 5px 10px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 500;
  background: transparent;
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: color 0.2s ease;
}

.fy-selector select:hover {
  color: var(--text);
}

.fy-selector select:focus {
  outline: none;
  color: var(--text);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fadeIn 200ms ease-out;
}

.modal-backdrop.modal-backdrop--centered {
  align-items: center;
}

.modal {
  width: 100%;
  max-width: 520px;
}

.modal .panel,
.modal .section-card {
  backdrop-filter: none;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.entry-card-popup {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.entry-card-popup > * {
  min-width: 0;
}

.entry-card-popup-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.entry-card-popup-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.entry-card-popup-body {
  display: grid;
  gap: 10px;
}

.entry-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-muted, #f8fafc);
}

.entry-card-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.entry-card-value {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 520px;
}

.modal-card-wide {
  max-width: 720px;
}

.modal-card-wide .page {
  gap: 14px;
}

.modal-card-wide .page-header {
  margin-bottom: 6px;
}

.modal-card-wide .page-title {
  font-size: 1.25rem;
}

.modal-card-wide .page-subtitle {
  font-size: 0.85rem;
  margin-top: 2px;
}

.modal-card-wide .invoice-new-grid {
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.modal-card-wide .section-card {
  padding: 20px;
}

.modal-card-wide .summary-actions {
  gap: 8px;
  margin-top: 14px;
}

.modal-card-wide .summary-actions .btn {
  padding: 10px 16px;
}

.card-popup-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  color: var(--text);
}

.card-popup-body {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
}

.card-popup-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.select-company-backdrop {
  align-items: center;
  overflow-y: auto;
}

.select-company-backdrop .modal {
  max-width: 560px;
  margin: auto;
}

.select-company-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.select-company-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.select-company-logo {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.select-company-heading-group {
  min-width: 0;
}

.select-company-heading {
  font-size: 1.35rem;
}

.select-company-note {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.select-company-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.select-company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.select-company-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.select-company-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 8px 24px rgba(7, 33, 68, 0.1);
}

.select-company-option:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.select-company-option:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.select-company-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.select-company-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.select-company-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.select-company-chevron {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--muted);
  transition:
    transform 0.15s ease,
    color 0.15s ease;
}

.select-company-option:hover:not(:disabled) .select-company-chevron {
  color: var(--accent);
  transform: translateX(2px);
}

.select-company-spinner {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: select-company-spin 0.7s linear infinite;
}

@keyframes select-company-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .select-company-spinner {
    animation-duration: 2s;
  }
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
}

.login-card .login-logo {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 14px;
}

.login-card .form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card .form-field-wide {
  grid-column: auto;
}

.login-card .auth-switch {
  text-align: center;
}

.signup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
}

.signup-card .auth-switch {
  text-align: center;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-span {
  grid-column: 1 / -1;
}

.panel-narrow {
  max-width: 640px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    transform 0.1s,
    opacity 0.15s,
    background 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-small {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover {
  color: var(--accent-hover);
}

.dialog-text {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.dialog-text--compact {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.modal-card-title {
  margin-top: 0;
  margin-bottom: 12px;
}

.table-wrap--mt {
  margin-top: 8px;
}

.btn-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}

.btn-warning:hover:not(:disabled) {
  background: #fcd34d;
  color: #78350f;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-bg);
  color: #065f46;
}

.btn-success:hover:not(:disabled) {
  background: var(--success);
  color: white;
  border-color: var(--success);
  transform: translateY(-1px);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.space-x-2 > * + * {
  margin-left: 0.5rem;
}

.space-y-1 > * + * {
  margin-top: 0.25rem;
}

.space-y-2 > * + * {
  margin-top: 0.5rem;
}

.space-y-3 > * + * {
  margin-top: 0.75rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: center;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.uppercase {
  text-transform: uppercase;
}

.leading-none {
  line-height: 1;
}

.leading-relaxed {
  line-height: 1.625;
}

.list-disc {
  list-style-type: disc;
}

.list-inside {
  list-style-position: inside;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.break-words {
  overflow-wrap: break-word;
  word-break: break-word;
}

.disabled\:opacity-50:disabled {
  opacity: 0.5;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 0.75rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mr-1 {
  margin-right: 0.25rem;
}

.mr-2 {
  margin-right: 0.5rem;
}

.ml-1 {
  margin-left: 0.25rem;
}

.ml-auto {
  margin-left: auto;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.p-3 {
  padding: 0.75rem;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.inline-flex {
  display: inline-flex;
}

.flex {
  display: flex;
}

.inline-block {
  display: inline-block;
}

.block {
  display: block;
}

.hidden {
  display: none;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

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

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

.justify-end {
  justify-content: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1 1 0%;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.min-w-0 {
  min-width: 0;
}

.min-w-full {
  min-width: 100%;
}

.w-7 {
  width: 1.75rem;
}

.w-8 {
  width: 2rem;
}

.w-full {
  width: 100%;
}

.h-7 {
  height: 1.75rem;
}

.h-8 {
  height: 2rem;
}

.h-32 {
  height: 8rem;
}

.h-full {
  height: 100%;
}

.max-w-3xl {
  max-width: 48rem;
}

.max-w-5xl {
  max-width: 64rem;
}

.max-w-full {
  max-width: 100%;
}

.max-h-\[90vh\] {
  max-height: 90vh;
}

.overflow-x-auto {
  overflow-x: auto;
}

.overflow-y-auto {
  overflow-y: auto;
}

.relative {
  position: relative;
}

.fixed {
  position: fixed;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.z-50 {
  z-index: 50;
}

.opacity-0 {
  opacity: 0;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-75 {
  opacity: 0.75;
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

.select-none {
  user-select: none;
}

.border {
  border: 1px solid var(--border);
}

.border-0 {
  border: 0;
}

.border-b {
  border-bottom: 1px solid var(--border);
}

.border-t {
  border-top: 1px solid var(--border);
}

.border-r {
  border-right: 1px solid var(--border);
}

.border-l {
  border-left: 1px solid var(--border);
}

.border-x {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.border-y {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.border-0 {
  border-width: 0;
}

.border-2 {
  border-width: 2px;
}

.border-t-0 {
  border-top-width: 0;
}

.border-b-0 {
  border-bottom-width: 0;
}

.rounded {
  border-radius: var(--radius-xs);
}

.rounded-lg {
  border-radius: var(--radius);
}

.rounded-full {
  border-radius: 9999px;
}

.rounded-none {
  border-radius: 0;
}

.bg-white {
  background: var(--surface);
}

.bg-transparent {
  background: transparent;
}

.bg-black {
  background: #000;
}

.bg-opacity-50 {
  --tw-bg-opacity: 0.5;
}

.bg-opacity-75 {
  --tw-bg-opacity: 0.75;
}

.bg-red-50 {
  background: #fef2f2;
}

.bg-yellow-50 {
  background: #fffbeb;
}

.bg-green-50 {
  background: #ecfdf5;
}

.bg-blue-50 {
  background: #eff6ff;
}

.bg-gray-50 {
  background: #f9fafb;
}

.bg-gray-100 {
  background: #f3f4f6;
}

.text-white {
  color: #fff;
}

.text-black {
  color: #000;
}

.text-gray-500 {
  color: #6b7280;
}

.text-gray-600 {
  color: #4b5563;
}

.text-gray-700 {
  color: #374151;
}

.text-gray-800 {
  color: #1f2937;
}

.text-gray-900 {
  color: #111827;
}

.text-red-700 {
  color: #991b1b;
}

.text-red-600 {
  color: #dc2626;
}

.text-red-500 {
  color: #ef4444;
}

.text-yellow-700 {
  color: #92400e;
}

.text-yellow-600 {
  color: #d97706;
}

.text-green-700 {
  color: #065f46;
}

.text-green-600 {
  color: #059669;
}

.text-blue-700 {
  color: #1d4ed8;
}

.text-blue-600 {
  color: #2563eb;
}

.text-blue-800 {
  color: #1e40af;
}

.text-green-800 {
  color: #064e3b;
}

.shadow {
  box-shadow: var(--shadow);
}

.shadow-xl {
  box-shadow: var(--shadow-lg);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.border-red-200 {
  border-color: #fecaca;
}

.border-yellow-200 {
  border-color: #fde68a;
}

.border-green-200 {
  border-color: #a7f3d0;
}

.border-blue-200 {
  border-color: #bfdbfe;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

.border-gray-300 {
  border-color: #d1d5db;
}

.border-green-100 {
  border-color: #d1fae5;
}

.border-yellow-100 {
  border-color: #fef3c7;
}

.border-red-100 {
  border-color: #fee2e2;
}

.divide-y {
  --tw-divide-y-reverse: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}

.divide-y > :not([hidden]) ~ :not([hidden]) {
  --tw-divide-x-reverse: 0;
  border-right-width: 0;
  border-left-width: 0;
  border-top-width: 1px;
  border-top-color: var(--border);
}

.divide-gray-200 {
  --tw-divide-opacity: 1;
  border-color: rgb(229 231 235 / var(--tw-divide-opacity));
}

.divide-y-0 {
  --tw-divide-y-reverse: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}

.divide-x-0 {
  --tw-divide-x-reverse: 0;
  border-right-width: 0;
  border-left-width: 0;
}

.hover\:bg-blue-700:hover {
  background: #1d4ed8;
}

.hover\:bg-red-700:hover {
  background: #991b1b;
}

.hover\:bg-green-700:hover {
  background: #065f46;
}

.hover\:text-blue-800:hover {
  color: #1e40af;
}

.hover\:text-red-800:hover {
  color: #991b1b;
}

.hover\:text-yellow-800:hover {
  color: #92400e;
}

.hover\:text-green-800:hover {
  color: #064e3b;
}

.hover\:bg-gray-50:hover {
  background: #f9fafb;
}

.hover\:bg-gray-100:hover {
  background: #f3f4f6;
}

.hover\:bg-subtle:hover {
  background: var(--bg-subtle);
}

.hover\:text-white:hover {
  color: #fff;
}

.focus\:outline-none:focus {
  outline: none;
}

.focus\:border-accent:focus {
  border-color: var(--accent);
}

.focus\:shadow-glow:focus {
  box-shadow: var(--shadow-glow);
}

.grid {
  display: grid;
}

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

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

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

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

.col-span-1 {
  grid-column: span 1 / span 1;
}

.col-span-2 {
  grid-column: span 2 / span 2;
}

.col-span-3 {
  grid-column: span 3 / span 3;
}

.col-span-full {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .md\:col-span-1 {
    grid-column: span 1 / span 1;
  }
  .md\:col-span-2 {
    grid-column: span 2 / span 2;
  }
  .md\:col-span-3 {
    grid-column: span 3 / span 3;
  }
  .md\:col-span-full {
    grid-column: 1 / -1;
  }
  .md\:flex {
    display: flex;
  }
  .md\:hidden {
    display: none;
  }
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .md\:w-auto {
    width: auto;
  }
  .md\:w-1\/2 {
    width: 50%;
  }
  .md\:w-1\/3 {
    width: 33.333333%;
  }
  .md\:w-2\/3 {
    width: 66.666667%;
  }
  .md\:w-full {
    width: 100%;
  }
  .md\:max-w-3xl {
    max-width: 48rem;
  }
  .md\:max-w-5xl {
    max-width: 64rem;
  }
  .md\:flex-row {
    flex-direction: row;
  }
  .md\:flex-col {
    flex-direction: column;
  }
  .md\:items-center {
    align-items: center;
  }
  .md\:justify-between {
    justify-content: space-between;
  }
  .md\:px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .lg\:col-span-2 {
    grid-column: span 2 / span 2;
  }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .sm\:hidden {
    display: none;
  }
  .sm\:block {
    display: block;
  }
  .sm\:flex {
    display: flex;
  }
  .sm\:grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .sm\:p-4 {
    padding: 1rem;
  }
  .sm\:px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .sm\:text-sm {
    font-size: 0.875rem;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-fade-in {
  animation: fadeIn 200ms ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.entry-panel {
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  backdrop-filter: blur(10px) saturate(180%);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
  display: block;
  text-decoration: none;
  color: inherit;
}

.summary-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.summary-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  word-break: break-word;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-width: 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 640px;
}

.table th,
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: middle;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover {
  background: var(--bg-subtle);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table .btn {
  margin-right: 6px;
}

.table .btn:last-child {
  margin-right: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-cards-stacked {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

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

.summary-card-row--single {
  grid-template-columns: 1fr;
}

.summary-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px) saturate(180%);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  display: block;
  text-decoration: none;
  color: inherit;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.summary-card-primary {
  background: linear-gradient(
    135deg,
    rgba(238, 242, 255, 0.9) 0%,
    rgba(232, 240, 255, 0.9) 100%
  );
  border-color: #c7d2fe;
}

.summary-card-primary:hover {
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.12);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 18px 20px;
  border-radius: var(--radius);
  border-width: 1px;
  border-style: solid;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.panel {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  backdrop-filter: blur(10px) saturate(180%);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.panel:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.payables-card {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.95) 0%,
    rgba(254, 243, 199, 0.9) 100%
  );
}

.payables-card:hover {
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.12);
}

.payables-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.85rem;
}

.payables-overdue {
  color: var(--danger);
  font-weight: 500;
}

.payables-due-today {
  color: var(--warning);
  font-weight: 500;
}

.aging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.tax-card {
  background: linear-gradient(
    135deg,
    rgba(238, 242, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.tax-card:hover {
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.1);
}

.tax-paid-card {
  background: linear-gradient(
    135deg,
    rgba(236, 253, 245, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.tax-paid-card:hover {
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.1);
}

.tax-outstanding-card {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.tax-outstanding-card:hover {
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.1);
}

.vat-card {
  background: linear-gradient(
    135deg,
    rgba(230, 247, 246, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.vat-card:hover {
  box-shadow: 0 10px 28px rgba(1, 171, 168, 0.1);
}

.tds-card {
  background: linear-gradient(
    135deg,
    rgba(239, 246, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.tds-card:hover {
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.1);
}

.tax-card-details,
.vat-card-details,
.tds-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.due-today-card {
  background: linear-gradient(
    135deg,
    rgba(254, 242, 242, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.due-today-card:hover {
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.1);
}

.due-7-card {
  background: linear-gradient(
    135deg,
    rgba(255, 247, 237, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.due-7-card:hover {
  box-shadow: 0 10px 28px rgba(249, 115, 22, 0.1);
}

.due-30-card {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.due-30-card:hover {
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.1);
}

.overdue-card {
  background: linear-gradient(
    135deg,
    rgba(254, 226, 226, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.overdue-card:hover {
  box-shadow: 0 10px 28px rgba(185, 28, 28, 0.1);
}

.aging-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.aging-row:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.aging-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aging-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
}

.aging-percentage {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.due-soon-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.due-soon-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.due-soon-row:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.due-soon-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.due-soon-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
}

.breakdown-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
}

.breakdown-overdue {
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 500;
  white-space: nowrap;
}

.summary-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-sublabel {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 4px;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
}

.amount-high {
  color: var(--success);
  font-weight: 700;
}

.amount-low {
  color: var(--danger);
  font-weight: 700;
}

.amount-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-cell--zero {
  color: var(--muted);
  font-weight: 400;
}

.amount-cell--positive {
  color: var(--success);
}

.amount-cell--negative {
  color: var(--danger);
}

.banner-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.banner-status--success {
  color: #065f46;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
}

.banner-status--warning {
  color: #92400e;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
}

.banner-warning {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.5;
}

.banner-warning strong {
  color: #78350f;
}

.banner-warning .duplicate-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.banner-warning .duplicate-list li {
  margin-bottom: 4px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-width: 0;
}

.transaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 600px;
}

.transaction-table th,
.transaction-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.transaction-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--border-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.transaction-table tbody tr:hover {
  background: var(--border-light);
}

.transaction-table tbody tr:last-child td {
  border-bottom: none;
}

.aging-buckets h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
}

.aging-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aging-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: box-shadow 0.15s ease;
}

.aging-card:hover {
  box-shadow: var(--shadow-sm);
}

.aging-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.aging-card-org {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.aging-card-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.aging-card-right {
  text-align: right;
  white-space: nowrap;
}

.aging-card-outstanding {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.aging-card-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--border-light);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

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

.aging-card-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aging-card-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aging-card-value {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.aging-card-btn {
  width: 100%;
  text-align: center;
}

.table-total-row td {
  background: #f4f9f9;
  border-top: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

.actions-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  justify-content: center;
  border-bottom: none !important;
}

.actions-cell .btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

.actions-cell .btn-small {
  padding: 8px 12px;
  font-size: 0.8rem;
}

.form-error {
  margin: 0 0 16px;
  color: var(--danger);
  font-size: 0.875rem;
}

.duplicate-list {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.875rem;
}

.empty-state,
.loading {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-page {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.organization-totals {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.organization-filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.organization-filters .search-field {
  min-width: 220px;
}

.col-actions {
  min-width: 220px;
  width: 220px;
  white-space: nowrap;
}

.org-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.org-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.section-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  backdrop-filter: blur(10px) saturate(180%);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
  overflow: visible;
}

.section-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Bank Reconciliation */
.rec-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rec-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.rec-detail-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rec-detail-header-info h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.rec-detail-header-meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.rec-detail-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.rec-status-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
}

.rec-status-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-status-banner-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.rec-reopen-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.rec-reopen-form .form-field {
  max-width: 400px;
  flex: 1 1 240px;
}

.rec-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.rec-count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.rec-difference-card {
  border: 2px solid var(--color-success, var(--success));
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rec-difference-card--danger {
  border-color: var(--color-danger, var(--danger));
}

.rec-difference-card .section-card-header {
  background: var(--bg-subtle);
  margin-bottom: 0;
  padding: 12px 16px;
}

.rec-difference-card .section-card-body {
  padding: 16px;
}

.rec-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
}

.rec-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.rec-breakdown-row--total {
  font-size: 1.1rem;
  font-weight: 700;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.rec-breakdown-row--remaining {
  font-size: 1.05rem;
  font-weight: 600;
}

.rec-breakdown-label {
  color: var(--text-secondary);
}

.rec-breakdown-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rec-breakdown-message {
  margin-top: 8px;
  font-weight: 600;
  color: var(--success);
}

.rec-breakdown-message--danger {
  color: var(--danger);
}

.rec-import-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rec-import-preview h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.rec-import-errors {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.875rem;
}

.rec-import-errors strong {
  display: block;
  margin-bottom: 8px;
}

.rec-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-suggestions h4 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}

.rec-suggestion-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.rec-suggestion-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.rec-suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rec-suggestion-header strong {
  color: var(--text);
}

.rec-suggestion-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rec-suggestion-date {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

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

.rec-suggestion-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.rec-table-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.rec-table-actions .form-select {
  min-width: 180px;
}

.rec-modal-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.rec-modal-details p {
  margin: 0;
  color: var(--text-secondary);
}

.rec-modal-details strong {
  color: var(--text);
}

.rec-modal-hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.rec-create-form {
  margin-bottom: 24px;
}

.rec-section-header {
  justify-content: space-between;
}

.rec-journal-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.rec-journal-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.table tbody tr.is-selected {
  background: var(--accent-light);
}

.support-quickinfo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.support-quickinfo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.support-quickinfo-item:hover {
  border-color: rgba(1, 171, 168, 0.35);
  box-shadow: var(--shadow);
}

.support-quickinfo-item > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.support-quickinfo-item strong {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.support-quickinfo-item span,
.support-quickinfo-item a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.support-quickinfo-item a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.support-quickinfo-item a:hover {
  text-decoration: underline;
}

.support-quickinfo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.help-search-wrap {
  margin-bottom: 8px;
  position: relative;
}

.help-search-logo {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.6;
}

.help-search-input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.help-search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.help-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
}

.help-search-clear:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.help-search-meta {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--muted);
}

.help-category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.help-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--accent-light);
  border: 1px solid rgba(1, 171, 168, 0.18);
  color: var(--accent);
  flex-shrink: 0;
}

.help-category-count {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.help-article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-article-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  margin: 0 -10px;
  border-bottom: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.help-article-list li:hover,
.help-article-list li:focus-visible {
  color: var(--accent);
  background: var(--accent-light);
  outline: none;
}

.help-article-list li:last-child {
  border-bottom: none;
}

.help-article-label {
  min-width: 0;
}

.help-article-arrow {
  display: inline-flex;
  opacity: 0;
  transform: translateX(-4px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  flex-shrink: 0;
}

.help-article-list li:hover .help-article-arrow,
.help-article-list li:focus-visible .help-article-arrow {
  opacity: 1;
  transform: translateX(0);
}

.support-article-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.support-article-title {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.support-article-body {
  margin: 0;
  max-width: 720px;
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.support-article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--muted);
}

.support-article-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.support-new-intro {
  display: flex;
  gap: 16px;
  padding: 20px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-light) 0%, rgba(244, 249, 249, 0.6) 100%);
  border: 1px solid rgba(1, 171, 168, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.support-new-intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid rgba(1, 171, 168, 0.25);
  color: var(--accent);
  flex-shrink: 0;
}

.support-new-intro-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}

.support-new-intro p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.support-new-tips {
  margin: 12px 0 14px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-new-tips li {
  position: relative;
  padding-left: 22px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.support-new-tips li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.support-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.support-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  transition:
    color 0.2s,
    background 0.2s;
}

.support-tab:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.support-tab-active,
.support-tab-active:hover {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

.support-tab-icon {
  display: inline-flex;
}

.ticket-row {
  cursor: pointer;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket-meta > span {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
}

.ticket-meta strong {
  color: var(--text);
  font-weight: 600;
}

.ticket-detail-title {
  font-size: 1.15rem;
}

.ticket-messages {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-message {
  padding: 14px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
}

.ticket-message--original {
  border-left: 3px solid var(--accent);
}

.ticket-message--staff {
  border-left: 3px solid var(--success);
  background: var(--success-bg);
}

.ticket-message--customer {
  border-left: 3px solid var(--muted);
}

.ticket-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ticket-message-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ticket-message--staff .ticket-message-avatar {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.ticket-message-author {
  margin: 0;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticket-message-staff-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ticket-message-text {
  margin: 0 0 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-message-time {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.ticket-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.ticket-status--open {
  background: var(--warning-bg);
  color: #92400e;
}

.ticket-status--in_progress {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.ticket-status--waiting_customer {
  background: #eff6ff;
  color: #1e3a8a;
}

.ticket-status--resolved {
  background: var(--success-bg);
  color: #065f46;
}

.ticket-status--closed {
  background: var(--bg-subtle);
  color: var(--muted);
}

.priority-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.priority-critical {
  background: var(--danger-bg);
  color: var(--danger);
}

.priority-high {
  background: var(--warning-bg);
  color: var(--warning);
}

.priority-normal {
  background: var(--bg-subtle);
  color: var(--muted);
}

.priority-feature {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.support-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.support-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  margin-bottom: 6px;
}

.support-empty h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.support-empty p {
  margin: 0 0 12px;
  font-size: 0.9rem;
  max-width: 380px;
}

.support-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.support-skeleton-row {
  height: 40px;
  border-radius: var(--radius-xs);
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 25%,
    rgba(234, 245, 245, 0.4) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 200% 100%;
  animation: support-shimmer 1.4s ease-in-out infinite;
}

@keyframes support-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 640px) {
  .support-new-intro {
    flex-direction: column;
    padding: 16px;
  }

  .support-tab {
    padding: 9px 12px;
  }
}

/* Feedback page */
.feedback-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.feedback-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feedback-categories {
  margin: 0;
  padding: 0;
  border: none;
}

.feedback-categories legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.feedback-segment {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.feedback-segment:hover {
  border-color: var(--accent);
  color: var(--text);
}

.feedback-segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.feedback-segment.is-active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-hover);
  font-weight: 600;
}

.feedback-segment:focus-within {
  box-shadow: var(--shadow-glow);
}

.feedback-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.feedback-counter {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.feedback-actions-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.feedback-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feedback-steps li {
  display: flex;
  gap: 12px;
}

.feedback-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 0.75rem;
  font-weight: 700;
}

.feedback-steps strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
}

.feedback-steps p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

.feedback-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feedback-tips li {
  position: relative;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.feedback-tips li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.feedback-support-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.feedback-support-note a {
  color: var(--accent);
  font-weight: 500;
}

@media (max-width: 1024px) {
  .feedback-layout {
    grid-template-columns: 1fr;
  }
}

/* Staff page */
.staff-card-header {
  flex-wrap: wrap;
  gap: 12px;
}

.staff-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.staff-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.staff-search {
  flex: 1 1 220px;
  max-width: 280px;
  margin-left: auto;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.staff-search::placeholder {
  color: #94a3b8;
}

.staff-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.staff-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.staff-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.staff-identity-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.staff-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  text-transform: capitalize;
}

.staff-you {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--border-light);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.staff-phone {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.staff-email {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-email-empty {
  color: var(--muted);
}

.staff-email-empty {
  color: var(--muted);
}

.staff-role {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.staff-role-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--muted);
}

.staff-role-dot--owner {
  background: var(--accent);
}

.staff-role-dot--accountant {
  background: #0369a1;
}

.staff-role-dot--staff {
  background: var(--success);
}

.staff-role-dot--viewer {
  background: var(--warning);
}

.staff-role-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 26px 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.staff-role-select:hover {
  border-color: var(--border);
  background-color: var(--surface);
}

.staff-role-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* Table chrome: tighter header, softer hairlines, fixed column rhythm */
.staff-table {
  table-layout: fixed;
}

.staff-table th {
  padding: 10px 14px;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
}

.staff-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* Keep every row the same height: 34px content + 2 x 11px padding */
.staff-table tbody tr {
  height: 56px;
}

.staff-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.staff-table th:nth-child(2) {
  width: 155px;
}

.staff-table th:nth-child(3) {
  width: 24%;
}

.staff-table th:nth-child(4) {
  width: 165px;
}

.staff-table th:nth-child(5) {
  width: 195px;
}

.staff-actions-head {
  text-align: right;
}

.staff-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Buttons match the 34px avatar block so every row is exactly the same height */
.staff-actions .btn {
  width: auto;
  min-width: 88px;
  height: 34px;
  padding: 0 14px;
  font-size: 0.8rem;
}

.staff-self-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .staff-search {
    max-width: none;
  }

  .staff-table th:nth-child(3),
  .staff-table td:nth-child(3) {
    display: none;
  }
}

.app-footer {
  padding: 20px 24px;
  text-align: center;
  border-top: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}

.app-footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.app-footer-links a,
.app-footer-links nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.app-footer-links a:hover,
.app-footer-links nav a:hover {
  color: var(--accent);
}

.app-footer-copy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.section-card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-card-body > * {
  min-width: 0;
}

.profit-card {
  background: linear-gradient(
    135deg,
    rgba(1, 171, 168, 0.08) 0%,
    rgba(16, 185, 129, 0.06) 100%
  );
}

.profit-card:hover {
  box-shadow: 0 10px 28px rgba(1, 171, 168, 0.1);
}

.profit-margin {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.margin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.margin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.margin-row span {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.margin-row strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

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

.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.form-field select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-subtle);
}

.autocomplete {
  position: relative;
  width: 100%;
}

.autocomplete-list {
  position: absolute;
  z-index: 20;
  top: calc(100% - 4px);
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
}

.autocomplete-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.autocomplete-item:hover,
.autocomplete-item-active {
  background: var(--accent-light);
}

.autocomplete-name {
  font-weight: 600;
}

.autocomplete-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.input-auto {
  background: var(--border-light);
}

.nepali-date-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nepali-date-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.day-stepper {
  display: flex;
  gap: 8px;
}

.day-btn {
  flex: 1;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.day-btn:hover {
  background: var(--border-light);
}

.day-btn:active {
  background: var(--border);
}

.date-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.daily-date-picker {
  min-width: 280px;
}

.daily-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.daily-grid > * {
  min-width: 0;
}

.daily-section h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  font-weight: 600;
}

.daily-section-form {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.daily-section-form .transaction-form h2 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.daily-section-form .form-note {
  margin-bottom: 12px;
}

.landing-home-link {
  text-decoration: none;
  color: inherit;
}

.landing-home-link:hover h1 {
  color: var(--accent);
}

.landing {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.landing-brand h1 {
  margin: 0 0 4px;
  font-size: 2.75rem;
  background: linear-gradient(135deg, var(--accent) 0%, #00705f 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.landing-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.landing-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}

.landing-cta {
  font-size: 1rem;
  padding: 12px 24px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  text-decoration: none;
}

.landing-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.landing-cta.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.landing-cta.btn-secondary:hover {
  background: var(--border-light);
}

.landing-hero {
  text-align: center;
  margin-bottom: 56px;
  padding: 48px 28px 36px;
  background: linear-gradient(135deg, var(--accent-light) 0%, #f4f9f9 100%);
  border-radius: var(--radius);
  border: 1px solid #c7d2fe;
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at top right,
      rgba(99, 102, 241, 0.12),
      transparent 40%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(139, 92, 246, 0.08),
      transparent 40%
    );
  pointer-events: none;
}

.landing-hero > * {
  position: relative;
}

.landing-hero-badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #c7d2fe;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.landing-hero h2 {
  margin: 0 0 12px;
  font-size: 2.4rem;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.landing-hero p {
  margin: 0 auto 24px;
  max-width: 640px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.landing-hero-actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.landing-hero-visual {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.landing-hero-preview {
  width: 100%;
  max-width: 860px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  text-align: left;
}

.landing-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #f4f9f9 0%, #e3eef3 100%);
  border-bottom: 1px solid var(--border);
}

.landing-preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.landing-preview-dot-red {
  background: #fca5a5;
}

.landing-preview-dot-yellow {
  background: #fcd34d;
}

.landing-preview-dot-green {
  background: #86efac;
}

.landing-preview-title {
  margin-left: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.landing-preview-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 18px;
}

.landing-preview-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-preview-line {
  height: 10px;
  border-radius: 999px;
  background: #b8d0e0;
}

.landing-preview-line-short {
  width: 65%;
}

.landing-preview-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.landing-preview-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.landing-preview-card {
  height: 56px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, var(--accent-light) 0%, #e6f7f6 100%);
  border: 1px solid #c7d2fe;
}

.landing-preview-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.landing-preview-row {
  height: 12px;
  border-radius: 999px;
  background: #e3eef3;
}

.landing-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.landing-highlight {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.landing-highlight h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.landing-highlight p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.landing-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}

.landing-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #c7d2fe;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.landing-hero-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.landing-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  animation: float-orb 8s ease-in-out infinite alternate;
}

.landing-hero-orb--one {
  width: 260px;
  height: 260px;
  background: #01aba8;
  top: -60px;
  left: -40px;
  animation-delay: 0s;
}

.landing-hero-orb--two {
  width: 220px;
  height: 220px;
  background: #00705f;
  bottom: -40px;
  right: -20px;
  animation-delay: 1.5s;
}

.landing-hero-orb--three {
  width: 180px;
  height: 180px;
  background: #a78bfa;
  top: 40%;
  left: 55%;
  animation-delay: 3s;
}

@keyframes float-orb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(20px, -24px) scale(1.08);
  }
}

.landing-hero-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.18),
    transparent 60%
  );
  transform: translate(
    calc(var(--mouse-x, 0) - 170px),
    calc(var(--mouse-y, 0) - 170px)
  );
  pointer-events: none;
  transition: transform 120ms ease-out;
}

.landing-hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.landing-hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 90px;
}

.landing-hero-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.landing-hero-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.landing-highlight {
  position: relative;
  overflow: hidden;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition:
    transform 200ms ease,
    box-shadow 200ms ease;
}

.landing-highlight:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.landing-highlight-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  margin-bottom: 10px;
}

.landing-highlight-icon-inner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.landing-highlight {
  animation: fade-up 420ms ease-out both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-hero,
.landing-highlights,
.landing-footer {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 600ms ease-out,
    transform 600ms ease-out;
  will-change: opacity, transform;
}

.landing-hero.is-visible,
.landing-highlights.is-visible,
.landing-footer.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.landing-preview-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-light) 0%, #e6f7f6 100%);
  border: 1px solid #c7d2fe;
}

.landing-preview-card-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(99, 102, 241, 0.12) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 500ms ease;
}

.landing-preview-card--active .landing-preview-card-glow {
  transform: translateX(100%);
}

.landing-preview-card-line {
  position: absolute;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.25);
  transition:
    transform 300ms ease,
    opacity 300ms ease;
  opacity: 0.7;
}

.landing-preview-card-line--title {
  width: 55%;
  height: 10px;
  top: 18px;
  left: 12px;
}

.landing-preview-card-line--amount {
  width: 38%;
  height: 10px;
  top: 34px;
  left: 12px;
}

.landing-preview-card-line--muted {
  width: 28%;
  height: 10px;
  top: 50px;
  left: 12px;
}

.landing-preview-card--active .landing-preview-card-line {
  transform: translateX(4px);
  opacity: 1;
}

.landing-highlight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(99, 102, 241, 0.06) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 500ms ease;
  pointer-events: none;
}

.landing-highlight:hover::before {
  transform: translateX(100%);
}

@media (max-width: 640px) {
  .landing {
    padding: 32px 16px 56px;
  }

  .landing-hero {
    padding: 28px 18px 24px;
  }

  .landing-hero h2 {
    font-size: 1.7rem;
  }

  .landing-preview-body {
    grid-template-columns: 1fr;
  }

  .landing-preview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-highlights {
    grid-template-columns: 1fr;
  }

  .landing-hero-orb--one {
    width: 160px;
    height: 160px;
    top: -40px;
    left: -30px;
  }

  .landing-hero-orb--two {
    width: 140px;
    height: 140px;
    bottom: -30px;
    right: -20px;
  }

  .landing-hero-orb--three {
    width: 120px;
    height: 120px;
  }

  .landing-hero-glow {
    width: 220px;
    height: 220px;
    transform: translate(
      calc(var(--mouse-x, 0) - 110px),
      calc(var(--mouse-y, 0) - 110px)
    );
  }

  .landing-hero-stats {
    gap: 20px;
    margin-top: 22px;
  }

  .landing-hero-stat-value {
    font-size: 1.15rem;
  }

  .landing-hero-stat-label {
    font-size: 0.7rem;
  }
}

.report-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.report-tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}

.report-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.report-tab-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.report-tab-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.ledger-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.ledger-accounts,
.ledger-detail {
  min-width: 0;
}

.ledger-accounts h3,
.ledger-detail h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
}

.ledger-account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.ledger-account-btn {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ledger-account-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ledger-account-btn span:last-child {
  flex-shrink: 0;
}

.ledger-account-btn:hover {
  background: var(--border-light);
  border-color: #cbd5e1;
}

.ledger-account-btn-active {
  background: var(--accent-light);
  border-color: #c7d2fe;
}

.ledger-account-btn-active:hover {
  background: #e0e7ff;
  border-color: #c7d2fe;
}

.ledger-entry-row-clickable {
  cursor: pointer;
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.report-columns > * {
  min-width: 0;
}

.report-columns--stacked {
  grid-template-columns: 1fr;
}

.report-columns .report-summary-panel {
  grid-column: 1 / -1;
}

.report-summary-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.report-net-result {
  margin: 0;
  font-size: 1.1rem;
}

.ledger-filters {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.ledger-filters .form-field {
  min-width: 160px;
}

.ledger-filters .form-field input[type="date"] {
  min-width: 160px;
}

.date-filter-clear {
  margin-bottom: 10px;
}

.entry-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.entry-type-income {
  background: var(--success-bg);
  color: #065f46;
}

.entry-type-expense {
  background: var(--danger-bg);
  color: #991b1b;
}

.coa-setup-panel {
  margin-bottom: 20px;
  border: 1px solid #c7d2fe;
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.coa-setup-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.coa-setup-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.875rem;
}

.coa-system-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #c7d2fe;
  color: #3730a3;
}

.coa-row-inactive {
  opacity: 0.6;
}

.coa-active-field .coa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.account-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.account-type-asset {
  background: var(--accent-light);
  color: var(--accent);
}

.account-type-liability {
  background: var(--warning-bg);
  color: #b45309;
}

.account-type-equity {
  background: var(--accent-light);
  color: var(--accent);
}

.account-type-income {
  background: var(--success-bg);
  color: #065f46;
}

.account-type-expense {
  background: var(--danger-bg);
  color: #b91c1c;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
}

.badge-success {
  background: var(--success-bg);
  color: #065f46;
}

.badge-warning {
  background: var(--warning-bg);
  color: #92400e;
}

.badge-danger {
  background: var(--danger-bg);
  color: #991b1b;
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--muted);
}

.badge-info {
  background: var(--accent-light);
  color: var(--accent-hover);
}

.badge-secondary {
  background: var(--border-light);
  color: var(--muted);
}

.badge-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-role-owner {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-role-accountant {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-role-staff {
  background: var(--success-bg);
  color: #065f46;
}

.badge-role-viewer {
  background: #fef3c7;
  color: #92400e;
}

.badge-role-developer {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-status-draft {
  background: #e3eef3;
  color: #475569;
  border: 1px solid #b8d0e0;
}

.badge-status-filed {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-status-paid {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge--paid {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge--partial {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge--void {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  background: var(--border-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.sortable {
  cursor: pointer;
  transition: background 0.2s ease;
}

.sortable:hover {
  background: var(--bg);
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: rgba(238, 242, 255, 0.6);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.not-found {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  min-height: 60vh;
}

.not-found-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  max-width: 960px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px;
}

.not-found-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.not-found-receipt {
  position: relative;
  width: 320px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f9f9 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 0.9rem;
  padding-bottom: 36px;
  clip-path: polygon(
    0% 0%,
    100% 0%,
    100% calc(100% - 16px),
    95% 100%,
    90% calc(100% - 16px),
    85% 100%,
    80% calc(100% - 16px),
    75% 100%,
    70% calc(100% - 16px),
    65% 100%,
    60% calc(100% - 16px),
    55% 100%,
    50% calc(100% - 16px),
    45% 100%,
    40% calc(100% - 16px),
    35% 100%,
    30% calc(100% - 16px),
    25% 100%,
    20% calc(100% - 16px),
    15% 100%,
    10% calc(100% - 16px),
    5% 100%,
    0% 100%
  );
  animation: receipt-print 420ms ease-out;
  transform-origin: top center;
}

@keyframes receipt-print {
  from {
    transform: scaleY(0.4) translateY(-12px);
    opacity: 0;
  }
  to {
    transform: scaleY(1) translateY(0);
    opacity: 1;
  }
}

.not-found-receipt-stamp {
  position: absolute;
  top: 38%;
  right: 8%;
  font-family: monospace;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.15em;
  color: #c0392b;
  border: 3px solid #c0392b;
  border-radius: 6px;
  padding: 4px 14px;
  transform: rotate(-14deg) scale(1.4);
  opacity: 0;
  mix-blend-mode: multiply;
  animation: stamp-down 180ms ease-out 480ms forwards;
}

@keyframes stamp-down {
  0% {
    opacity: 0;
    transform: rotate(-14deg) scale(2.2);
  }
  70% {
    opacity: 0.85;
    transform: rotate(-14deg) scale(1.3);
  }
  100% {
    opacity: 0.85;
    transform: rotate(-14deg) scale(1.45);
  }
}

.not-found-receipt-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #f4f9f9 0%, #e3eef3 100%);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.not-found-receipt-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.not-found-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.not-found-receipt-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.not-found-row {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1fr;
  gap: 10px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.not-found-right {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-weight: 500;
}

.not-found-row-muted {
  color: var(--muted);
  animation: row-fade 260ms ease-out both;
  animation-delay: var(--row-delay, 0ms);
}

@keyframes row-fade {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.not-found-row-highlight {
  color: var(--text);
  font-weight: 600;
}

.not-found-row-total {
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
}

.not-found-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.not-found-receipt-footer {
  padding: 10px 18px 16px;
  border-top: 1px dashed var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.not-found-recalculate {
  margin-top: 8px;
  border: 1px dashed currentColor;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.7;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.not-found-recalculate:hover {
  opacity: 1;
  transform: rotate(-2deg);
}

.not-found-text {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.not-found-text h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.not-found-text p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 420px;
}

.not-found-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.not-found-row-ticking span:last-child {
  font-variant-numeric: tabular-nums;
  animation: tick-pulse 1s ease-in-out infinite;
}

@keyframes tick-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.not-found-receipt-barcode {
  height: 24px;
  margin: 10px 0 4px;
  background: repeating-linear-gradient(
    90deg,
    currentColor 0px,
    currentColor 2px,
    transparent 2px,
    transparent 4px,
    currentColor 4px,
    currentColor 5px,
    transparent 5px,
    transparent 9px
  );
  opacity: 0.55;
}

.not-found-scrap {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 6px;
  height: 10px;
  background: currentColor;
  opacity: 0.6;
  border-radius: 1px;
  animation: scrap-fly 650ms ease-out forwards;
}

@keyframes scrap-fly {
  from {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.6;
  }
  to {
    transform: translate(var(--x), -34px) rotate(var(--rot));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .not-found-receipt,
  .not-found-row-muted,
  .not-found-receipt-stamp,
  .not-found-row-ticking span:last-child,
  .not-found-scrap {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 860px) {
  .not-found-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 28px 20px;
  }

  .not-found-text p {
    max-width: 100%;
  }

  .not-found-actions {
    justify-content: center;
  }
}

.table-empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .ledger-layout {
    grid-template-columns: 200px 1fr;
  }

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

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

  .account-type-badge {
    padding: 2px 6px;
    font-size: 0.7rem;
  }
}

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.hide-mobile {
  display: none;
}

.chart-container {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-panel {
  min-width: 0;
}

.chart-panel-narrow {
  grid-column: span 1;
}

.chart-screen-notice {
  grid-column: 1 / -1;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  margin: 0;
  display: none;
}

.chart-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.chart-tooltip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-tooltip-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-tooltip-name {
  flex: 1;
  color: var(--muted);
}

.chart-tooltip-value {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.chart-tooltip-label {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.chart-legend {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.8rem;
  color: var(--muted);
  transition: opacity 0.2s ease;
}

.chart-legend-item:hover {
  opacity: 0.7;
}

.chart-legend-item-inactive {
  opacity: 0.35;
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-name {
  white-space: nowrap;
}

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

.chart-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chart-panel-action {
  flex-shrink: 0;
}

.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--muted);
}

.chart-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.chart-loading-text {
  font-size: 0.85rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.chart-empty-icon {
  opacity: 0.4;
  color: var(--muted);
}

.chart-empty-text {
  margin: 0;
  font-size: 0.9rem;
}

.chart-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--danger);
  text-align: center;
}

.chart-error-icon {
  opacity: 0.6;
}

.chart-error-text {
  margin: 0;
  font-size: 0.9rem;
}

.chart-error-retry {
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.chart-error-retry:hover {
  background: #fecaca;
}

.chart-panel-wrapper {
  min-width: 0;
}

.chart-panel-wrapper--span-2 {
  grid-column: span 2;
}

.chart-panel-wrapper--span-3 {
  grid-column: span 3;
}

.chart-panel-wrapper--span-4 {
  grid-column: span 4;
}

.metric-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px) saturate(180%);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card-clickable {
  cursor: pointer;
}

.metric-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.metric-card-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.metric-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.metric-card-value-error {
  color: var(--danger);
}

.metric-card-change {
  font-size: 0.8rem;
  font-weight: 500;
}

.metric-change-up {
  color: var(--success);
}

.metric-change-down {
  color: var(--danger);
}

.metric-change-neutral {
  color: var(--muted);
}

.metric-card-error {
  font-size: 0.75rem;
  color: var(--danger);
}

.trend-widget-chart {
  width: 100%;
  height: 120px;
}

.trend-sparkline {
  width: 100%;
  height: 100%;
  display: block;
}

.breakdown-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.breakdown-row-clickable {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

.breakdown-row-clickable:hover {
  background: var(--bg-subtle);
}

.breakdown-name {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.breakdown-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  min-width: 40px;
}

.breakdown-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.breakdown-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}

.breakdown-percentage {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.ranking-widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-widget-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  padding: 4px 0;
}

.ranking-widget-item-clickable {
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

.ranking-widget-item-clickable:hover {
  background: var(--bg-subtle);
}

.ranking-widget-rank {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ranking-widget-name {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ranking-widget-primary {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
}

.ranking-widget-secondary {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.summary-widget {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-widget-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.summary-widget-row:last-child {
  border-bottom: none;
}

.summary-widget-label {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.summary-widget-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
}

.summary-widget-change {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.summary-widget-change-up {
  color: var(--success);
}

.summary-widget-change-down {
  color: var(--danger);
}

.summary-widget-change-neutral {
  color: var(--muted);
}

.bi-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.bi-dashboard-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.bi-dashboard-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.bi-dashboard-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
  .bi-dashboard-grid--3,
  .bi-dashboard-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .bi-dashboard-grid--2,
  .bi-dashboard-grid--3,
  .bi-dashboard-grid--4 {
    grid-template-columns: 1fr;
  }
}

.kpi-dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kpi-section {
  position: relative;
}

.kpi-section--primary .section-card {
  border-color: rgba(1, 171, 168, 0.18);
  box-shadow: 0 4px 24px rgba(1, 171, 168, 0.06);
}

.kpi-section-grid {
  display: grid;
  gap: 20px;
}

.kpi-section-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1024px) {
  .kpi-section-grid--2 {
    grid-template-columns: 1fr;
  }
}

.kpi-grid {
  grid-template-columns: repeat(4, 1fr);
}

.kpi-grid .summary-card-row {
  grid-template-columns: 1fr;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

.kpi-change-up {
  color: var(--success);
  background: var(--success-bg);
}

.kpi-change-down {
  color: var(--danger);
  background: var(--danger-bg);
}

.metric-error {
  display: block;
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 6px;
  font-weight: 500;
}

.revenue-card {
  background: linear-gradient(
    135deg,
    rgba(230, 247, 246, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.expense-card {
  background: linear-gradient(
    135deg,
    rgba(254, 226, 226, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.inventory-value-card {
  background: linear-gradient(
    135deg,
    rgba(230, 247, 246, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.inventory-quantity-card {
  background: linear-gradient(
    135deg,
    rgba(238, 242, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.low-stock-card {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.7) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.out-of-stock-card {
  background: linear-gradient(
    135deg,
    rgba(254, 226, 226, 0.6) 0%,
    rgba(255, 255, 255, 0.85) 100%
  );
}

.inventory-trend {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.trend-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.trend-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.trend-mode-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 6px 12px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.trend-mode-toggle button.active {
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  min-height: 220px;
  overflow-x: auto;
}

.trend-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 28px;
}

.trend-bar-container {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trend-bar {
  width: 100%;
  max-width: 48px;
  background: var(--accent-gradient);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  min-height: 6px;
}

.trend-bar:hover {
  opacity: 0.85;
  transform: scaleX(1.04);
}

.trend-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.trend-bar:hover .trend-tooltip {
  opacity: 1;
}

.trend-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  word-break: keep-all;
  white-space: nowrap;
}

.warehouse-inventory h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.product-inventory-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: auto;
}

.table-controls {
  display: flex;
  justify-content: flex-end;
}

.rec-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.rec-filters-left {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  flex: 1;
  min-width: 220px;
}

.rec-filters-right {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
}

.rec-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.rec-filter-field input,
.rec-filter-field select {
  width: 100%;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.rec-filter-field input:focus,
.rec-filter-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1, 171, 168, 0.12);
}

.table-search {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  min-width: 220px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.table-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(1, 171, 168, 0.12);
}

.table-search::placeholder {
  color: #94a3b8;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.table-pagination button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.table-pagination button:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--accent);
}

.table-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-danger {
  color: #991b1b;
  background: #fee2e2;
}

.status-warning {
  color: #92400e;
  background: #fffbeb;
}

.status-ok {
  color: #065f46;
  background: #ecfdf5;
}

.chart-loading,
.chart-error,
.chart-empty,
.table-loading,
.table-error,
.table-empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 20px;
  font-size: 0.9rem;
}

.chart-error,
.table-error {
  color: var(--danger);
}

.revenue-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

.expense-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

.revenue-change-neutral {
  color: var(--muted);
  background: var(--bg-subtle);
}

.revenue-change-up {
  color: var(--success);
  background: var(--success-bg);
}

.revenue-change-down {
  color: var(--danger);
  background: var(--danger-bg);
}

.expense-change-neutral {
  color: var(--muted);
  background: var(--bg-subtle);
}

.expense-change-up {
  color: var(--danger);
  background: var(--danger-bg);
}

.expense-change-down {
  color: var(--success);
  background: var(--success-bg);
}

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

.comparison-current,
.comparison-previous,
.comparison-change {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  text-align: center;
}

.comparison-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.comparison-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  word-break: break-word;
}

.comparison-up {
  color: var(--success);
}

.comparison-down {
  color: var(--danger);
}

.comparison-neutral {
  color: var(--muted);
}

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

.bi-section-gap {
  margin-top: 24px;
}

.receivables-card {
  background: rgba(255, 248, 247, 0.9);
}

.receivables-value {
  font-size: 1.5rem;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.receivables-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.receivables-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.receivables-badge-overdue {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.receivables-badge-due-today {
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.overdue-summary {
  border: none;
  background: rgba(255, 248, 247, 0.85);
  border: 1px solid rgba(239, 68, 68, 0.1);
}

.overdue-summary-title,
.aging-summary-title,
.customer-balances-title,
.receivables-trend-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
  color: var(--text);
}

.overdue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overdue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.overdue-row:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border);
}

.overdue-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.overdue-amount {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--text);
}

.overdue-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.overdue-total-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.overdue-total-amount {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: #b91c1c;
}

.receivables-aging {
  border: none;
  background: rgba(255, 248, 247, 0.85);
  border: 1px solid rgba(239, 68, 68, 0.1);
}

.aging-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aging-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px;
  align-items: center;
  gap: 12px;
}

.aging-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.aging-amount {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--text);
}

.aging-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.aging-bar-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(239, 68, 68, 0.9),
    rgba(248, 113, 113, 0.8)
  );
  border-radius: 4px;
  transition: width 0.4s ease;
}

.aging-percentage {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.customer-balances {
  border: none;
}

.customer-balances-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
  color: var(--text);
}

.customer-balances-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-balances-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

.customer-balances-row:hover {
  background: var(--bg-subtle);
}

.customer-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.customer-amount {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

.customer-overdue {
  font-size: 0.8rem;
  font-weight: 500;
  color: #b91c1c;
  white-space: nowrap;
}

.receivables-trend {
  border: none;
}

.receivables-trend-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
  color: var(--text);
}

.overdue-current {
  border-left: 2px solid transparent;
}

.overdue-1-30 {
  border-left: 2px solid rgba(245, 158, 11, 0.35);
}

.overdue-31-60 {
  border-left: 2px solid rgba(251, 146, 60, 0.4);
}

.overdue-61-90 {
  border-left: 2px solid rgba(239, 68, 68, 0.5);
}

.overdue-90-plus {
  border-left: 2px solid rgba(220, 38, 38, 0.6);
}

@media (max-width: 768px) {
  .comparison {
    grid-template-columns: 1fr;
  }

  .bi-bottom-grid {
    grid-template-columns: 1fr;
  }

  .aging-row {
    grid-template-columns: 80px 1fr 60px;
    gap: 8px;
  }

  .customer-balances-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

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

.kpi-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.kpi-card-link:hover {
  text-decoration: none;
}

.kpi-card-link:hover .summary-value {
  color: var(--accent);
}

.kpi-empty {
  text-align: center;
  padding: 48px 24px;
}

.kpi-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ledger-search-field {
  min-width: 100%;
}

.taskbar-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.taskbar-mobile-toggle svg {
  display: block;
}

.taskbar-nav-open {
  display: flex !important;
}

@media (max-width: 768px) {
  .report-columns {
    grid-template-columns: 1fr;
  }

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

  .landing-preview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .ledger-account-btn {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .account-type-badge {
    padding: 2px 8px;
    font-size: 0.7rem;
  }

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

  .modal-backdrop {
    padding: 20px;
  }

  .modal-card {
    padding: 24px 20px;
  }

  .login-card,
  .signup-card {
    padding: 24px 20px;
    max-width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
  }

  .dashboard-charts {
    grid-template-columns: 1fr;
  }

  .chart-screen-notice {
    display: block;
  }

  .ledger-layout {
    grid-template-columns: 1fr;
  }

  .ledger-accounts {
    max-height: 40vh;
  }

  .ledger-account-list {
    max-height: calc(40vh - 50px);
  }

  .ledger-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-preview-body {
    grid-template-columns: 1fr;
  }

  .landing-preview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-preview-sidebar {
    display: none;
  }

  .nepali-date-fields {
    grid-template-columns: repeat(3, 1fr);
  }

  .day-stepper {
    flex-wrap: wrap;
  }

  .search-field input,
  .search-field select,
  .search-field textarea {
    min-width: 100%;
  }

  .organization-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions {
    flex-direction: column;
  }

  .policy-header {
    flex-wrap: wrap;
  }

  .aging-table-desktop {
    display: none;
  }

  .aging-cards-mobile {
    display: block;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 16px;
  }

  .page-title {
    font-size: 1.25rem;
  }

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

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

  .data-table {
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td,
  .transaction-table th,
  .transaction-table td {
    padding: 8px 10px;
  }

  .hide-mobile {
    display: none;
  }

  .aging-card {
    padding: 12px;
    gap: 8px;
  }

  .aging-card-org {
    font-size: 0.85rem;
  }

  .aging-card-outstanding {
    font-size: 0.85rem;
  }

  .aging-card-meta {
    font-size: 0.75rem;
    gap: 12px;
  }

  .aging-card-btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

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

  .aging-card-label {
    font-size: 0.7rem;
  }

  .aging-card-value {
    font-size: 0.8rem;
  }

  .taskbar-nav {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 200;
  }

  .taskbar-nav-open {
    display: flex !important;
  }

  .taskbar-nav-row {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .taskbar-link,
  .taskbar-link-group {
    width: 100%;
    border-radius: var(--radius-xs);
    padding: 10px 12px;
  }

  .taskbar-link-icon {
    display: inline-flex;
  }

  .taskbar-mobile-toggle {
    display: inline-flex;
  }

  .taskbar-fy-trigger {
    display: none;
  }

  .page-actions {
    width: 100%;
    gap: 8px;
  }

  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .daily-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
  }

  .daily-date-picker {
    min-width: 100%;
  }

  .section-card {
    padding: 16px;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
  }

  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
  }

  .card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  .card + .card {
    margin-top: 16px;
  }

  .panel {
    padding: 18px;
  }

  .panel-narrow {
    max-width: 100%;
  }

  .page-centered {
    margin: 16px auto;
    padding: 0 16px;
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-value {
    font-size: 1rem;
  }

  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .pagination-controls {
    justify-content: center;
  }

  .not-found-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 24px 16px;
  }

  .not-found-visual {
    display: none;
  }

  .landing {
    padding: 24px 16px 48px;
  }

  .landing-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
  }

  .landing-hero {
    padding: 24px 16px;
  }

  .landing-hero h2 {
    font-size: 1.5rem;
  }

  .landing-hero p {
    font-size: 0.95rem;
  }

  .landing-brand h1 {
    font-size: 1.75rem;
  }

  .landing-preview-body {
    grid-template-columns: 1fr;
  }

  .landing-preview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .select-company-grid {
    grid-template-columns: 1fr;
  }

  .select-company-card {
    padding: 20px 16px;
  }

  .select-company-header {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .select-company-heading {
    font-size: 1.2rem;
  }

  .modal-backdrop {
    padding: 16px;
  }

  .modal-card {
    padding: 20px 16px;
  }

  .login-card,
  .signup-card {
    padding: 20px 16px;
    max-width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    width: 100%;
  }

  .daily-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
  }

  .dashboard-charts {
    grid-template-columns: 1fr;
  }

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

  .ledger-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .landing-preview-body {
    grid-template-columns: 1fr;
  }

  .landing-preview-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .landing-preview-sidebar {
    display: none;
  }

  .nepali-date-fields {
    grid-template-columns: repeat(3, 1fr);
  }

  .day-stepper {
    flex-wrap: wrap;
  }

  .search-field input,
  .search-field select,
  .search-field textarea {
    min-width: 100%;
  }

  .organization-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions {
    flex-direction: column;
  }

  .policy-header {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .landing-preview-cards {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .summary-card-row {
    grid-template-columns: 1fr;
  }

  .not-found-card {
    padding: 16px 12px;
  }

  .landing-brand h1 {
    font-size: 1.5rem;
  }

  .landing-hero h2 {
    font-size: 1.3rem;
  }

  .ledger-account-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  .ledger-accounts {
    max-height: 35vh;
  }

  .ledger-account-list {
    max-height: calc(35vh - 40px);
  }

  .account-type-badge {
    padding: 1px 6px;
    font-size: 0.65rem;
  }
}

@media (max-width: 375px) {
  .page-title {
    font-size: 1.1rem;
  }

  .landing-hero h2 {
    font-size: 1.3rem;
  }

  .transaction-table th,
  .transaction-table td {
    padding: 6px 8px;
  }

  .aging-card {
    padding: 10px;
    gap: 6px;
  }

  .aging-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .aging-card-right {
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .aging-card-outstanding {
    font-size: 0.8rem;
  }

  .aging-card-badge {
    margin-top: 0;
  }

  .aging-card-org {
    font-size: 0.8rem;
  }

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

  .aging-card-label {
    font-size: 0.65rem;
  }

  .aging-card-value {
    font-size: 0.75rem;
  }

  .aging-card-btn {
    padding: 8px 10px;
    font-size: 0.75rem;
  }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-bar .input {
  min-width: 160px;
  flex: 1 1 auto;
}

.import-history-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-select:hover:not(:focus) {
  border-color: #cbd5e1;
}

.input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder {
  color: #94a3b8;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 120px;
  flex-shrink: 0;
}

.detail-value {
  text-align: right;
  word-break: break-word;
  flex: 1 1 auto;
}

.table-cell-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.code-old {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.code-new {
  background: var(--success-bg);
  color: var(--success);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.json-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 4px 0 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--bg-subtle);
}

/* Audit trail */
.audit-filters {
  display: grid;
  gap: 14px;
}

.audit-search-row {
  position: relative;
}

.audit-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.audit-search-row .input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 42px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.audit-filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.audit-filters-row .form-field > span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.audit-filters-row .input,
.audit-filters-row .filter-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.audit-filters-row .filter-select {
  padding: 0 34px 0 12px;
}

.audit-filter-actions {
  display: flex;
  align-items: flex-end;
}

.audit-filter-actions .btn {
  height: 38px;
}

.audit-table th {
  white-space: nowrap;
}

.audit-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}

.audit-cell-time {
  white-space: nowrap;
}

.audit-time-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.audit-time-date {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.audit-time-clock {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.audit-cell-user {
  font-weight: 500;
  color: var(--text);
}

.audit-cell-event {
  font-size: 0.8rem;
  color: var(--muted);
}

.audit-cell-changes {
  white-space: nowrap;
}

.audit-changes-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 0.75rem;
  font-weight: 600;
}

.audit-no-changes {
  color: var(--muted);
}

.audit-record {
  font-weight: 500;
  color: var(--text);
}

.audit-record-name {
  font-weight: 600;
}

.audit-record-id {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.modal-card-audit {
  max-width: 640px;
}

.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.audit-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.audit-badge-success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.audit-badge-warning {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.audit-badge-danger {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.audit-badge-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.audit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.audit-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: var(--font-display);
}

.audit-modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.audit-modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.audit-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.audit-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.audit-detail-item-wide {
  grid-column: 1 / -1;
}

.audit-detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.audit-detail-value {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.audit-changes-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-section-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.audit-changes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-change-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.audit-change-field {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.audit-change-values {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-change-arrow {
  color: var(--muted);
  font-size: 0.85rem;
}

.audit-code-old {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  border: 1px solid #fecaca;
}

.audit-code-new {
  background: var(--success-bg);
  color: #065f46;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  border: 1px solid #a7f3d0;
}

.audit-json-details {
  margin-top: 4px;
}

.audit-json-summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  user-select: none;
}

.audit-json-summary:hover {
  color: var(--accent-hover);
}

.audit-json-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.audit-json-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 12px;
  overflow-x: auto;
}

.audit-json-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.audit-json-block pre {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-card-audit {
  max-width: 680px;
}

/* Communication history */
.comm-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}

.comm-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.comm-tab:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.comm-tab-active,
.comm-tab-active:hover {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 6px 16px rgba(1, 171, 168, 0.25);
}

.comm-tab-count {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(7, 33, 68, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.comm-tab-active .comm-tab-count {
  background: rgba(255, 255, 255, 0.24);
}

.comm-filter-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.comm-search-wrap {
  position: relative;
  display: block;
}

.comm-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  color: var(--muted);
  pointer-events: none;
}

.comm-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 18px;
}

.comm-filter-item {
  flex: 1 1 190px;
  min-width: 0;
  width: auto;
}

.comm-filter-date {
  flex: 1 1 150px;
}

.comm-filter-grid .search-field > span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.comm-filter-grid .search-field input,
.comm-filter-grid .search-field .input,
.comm-filter-grid .comm-search-wrap input {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 12px;
  font-size: 0.875rem;
  font-weight: 400;
}

.comm-filter-grid .comm-search-wrap input {
  height: 44px;
  padding: 0 14px 0 42px;
  font-size: 0.925rem;
}

.comm-filter-grid .search-field .filter-select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  font-size: 0.875rem;
}

.comm-clear {
  flex: 0 0 auto;
  height: 40px;
  margin-left: auto;
  padding: 0 16px;
}

.comm-table th {
  white-space: nowrap;
}

.comm-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}

.comm-table tbody tr:last-child td {
  border-bottom: none;
}

.comm-cell-primary {
  min-width: 190px;
}

.comm-cell-label {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.comm-cell-sub {
  display: block;
  max-width: 220px;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-cell-provider {
  min-width: 130px;
}

.comm-cell-attempts {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.comm-cell-time {
  white-space: nowrap;
}

.comm-empty {
  color: var(--muted);
}

.comm-time-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.comm-time-date {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.comm-time-clock {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.comm-time-relative {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

.comm-mono {
  font-family: var(--font-mono);
}

.comm-badge-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

.comm-badge-email {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.comm-badge-sms {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.comm-badge-whatsapp {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.comm-badge-processing {
  background: var(--accent-light);
  color: var(--accent-hover);
  border: 1px solid rgba(1, 171, 168, 0.3);
}

.comm-badge-sent {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.comm-badge-read {
  background: var(--success-bg);
  color: #047857;
  border: 1px solid #6ee7b7;
}

.comm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.comm-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.comm-modal {
  max-width: 640px;
}

.comm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.comm-modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.comm-modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.comm-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comm-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.comm-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
}

.comm-detail-wide {
  grid-column: 1 / -1;
}

.comm-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.comm-detail-value {
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.comm-error-block {
  padding: 12px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-xs);
}

.comm-error-text {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #991b1b;
  white-space: pre-wrap;
  word-break: break-word;
}

.comm-json-block {
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
}

.comm-json-block pre {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .comm-filter-item,
  .comm-filter-date {
    flex: 1 1 100%;
  }

  .comm-clear {
    width: 100%;
    margin-left: 0;
  }

  .comm-tabs {
    width: 100%;
  }

  .comm-tab {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 12px;
  }
}

.import-upload {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  background: var(--bg-subtle);
  transition:
    border-color 0.2s,
    background 0.2s;
  cursor: pointer;
}

.import-dropzone:hover,
.import-dropzone-active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.import-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.import-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  color: var(--accent);
}

.import-dropzone-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.import-dropzone-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.import-file-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

.import-file-remove {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  line-height: 0;
  transition: color 0.15s;
}

.import-file-remove:hover {
  color: var(--danger);
}

.column-mapping {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mapping-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mapping-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--border-light);
  border-bottom: 1px solid var(--border);
}

.mapping-header > div {
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mapping-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
}

.mapping-row:last-child {
  border-bottom: none;
}

.mapping-source {
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  align-items: center;
}

.mapping-source input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.mapping-row select {
  border: none;
  border-radius: 0;
  background: transparent;
}

.mapping-row select:focus {
  box-shadow: none;
  border-radius: 0;
}

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

.mapping-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mapping-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--border-light);
  color: var(--muted);
  border: 1px solid var(--border);
}

.mapping-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.import-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.stat-valid {
  color: var(--success);
}

.stat-warning {
  color: #b45309;
}

.stat-error {
  color: var(--danger);
}

.preview-errors {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.preview-errors summary {
  padding: 10px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--bg-subtle);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.preview-errors summary::-webkit-details-marker {
  display: none;
}

.preview-errors summary:hover {
  background: var(--border-light);
}

.preview-errors summary::after {
  content: "Ã¢â€“Â¾";
  font-size: 0.75rem;
  margin-left: auto;
  transition: transform 0.2s;
}

.preview-errors[open] summary::after {
  transform: rotate(180deg);
}

.error-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.error-item {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  font-size: 0.875rem;
}

.error-item strong {
  color: #991b1b;
  font-weight: 600;
}

.error-item ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.error-item li {
  margin-bottom: 3px;
  color: #991b1b;
}

.error-item li.warning {
  color: #b45309;
}

.import-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  transition: width 300ms ease-out;
}

.progress-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.import-result-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-radius: var(--radius);
  animation: importResultIn 380ms ease-out;
  border: 1px solid transparent;
}

@keyframes importResultIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.import-success {
  background: var(--success-bg);
  border-color: #a7f3d0;
}

.import-error {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.import-result-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.import-result-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-success {
  background: #d1fae5;
  color: #065f46;
}

.icon-error {
  background: #fee2e2;
  color: #991b1b;
}

.import-result-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.import-success .import-result-header h3 {
  color: #065f46;
}

.import-error .import-result-header h3 {
  color: #991b1b;
}

.import-result-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.import-result-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.import-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border-light);
  text-align: center;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.import-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.import-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.import-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-valid {
  color: #059669;
}

.stat-imported {
  color: var(--accent);
}

.stat-error {
  color: #dc2626;
}

.import-result-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.5;
}

.import-result-notice p {
  margin: 0;
}

.import-result-errors {
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.import-result-errors summary {
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #991b1b;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 160ms ease;
}

.import-result-errors summary::-webkit-details-marker {
  display: none;
}

.import-result-errors summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 200ms ease;
  margin-bottom: 3px;
}

.import-result-errors[open] summary::before {
  transform: rotate(45deg);
}

.import-result-errors .error-list {
  border-top: 1px solid var(--border-light);
  padding: 10px 14px;
  max-height: 260px;
  overflow-y: auto;
}

.import-result-errors .error-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
}

.import-result-errors .error-item:last-child {
  border-bottom: none;
}

.import-result-errors .error-item ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.import-result-errors .error-item li {
  margin-bottom: 2px;
}

.import-result-errors .error-item li.warning {
  color: #b45309;
}

.import-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .import-result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .import-result-stats {
    grid-template-columns: 1fr;
  }

  .import-result-header {
    flex-direction: column;
    text-align: center;
  }
}

.import-help {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

.import-help ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.import-help li {
  margin-bottom: 3px;
}

@media (max-width: 768px) {
  .preview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .import-result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mapping-header,
  .mapping-row {
    grid-template-columns: 1fr;
  }

  .mapping-source {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }

  .mapping-row select {
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .preview-stats {
    grid-template-columns: 1fr;
  }

  .import-result-stats {
    grid-template-columns: 1fr;
  }
}

.invoice-new-page {
  max-width: 1400px;
}

.invoice-new-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.invoice-new-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.invoice-new-summary {
  position: sticky;
  top: 20px;
}

.customer-search {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.customer-search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-width: 400px;
}

.customer-clear {
  flex-shrink: 0;
}

.customer-results {
  margin-top: 8px;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
}

.customer-result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.customer-result-item:hover,
.customer-result-item-active {
  background: var(--accent-light);
}

.customer-result-name {
  font-weight: 600;
}

.customer-result-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.customer-result-create {
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
  padding-top: 8px;
}

.customer-details {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border-light);
}

.customer-details-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

.customer-details-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.customer-details-meta span {
  font-weight: 500;
  color: var(--muted);
  margin-right: 4px;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.invoice-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.invoice-items-table .input-number {
  width: 80px;
  text-align: right;
}

.invoice-items-table td {
  vertical-align: top;
}

.discount-field {
  display: flex;
  gap: 4px;
  align-items: center;
}

.discount-field input {
  width: 80px;
  text-align: right;
}

.discount-type-select {
  width: 60px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.line-calculations {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.line-calculation {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--border-light);
  min-width: 160px;
  flex: 1;
}

.line-calculation-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-calculation-row {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.line-calculation-row--total {
  font-weight: 600;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 2px;
}

.invoice-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 6px 0;
}

.invoice-totals-row--divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.invoice-totals-row--gross {
  font-weight: 500;
  color: var(--text);
}

.invoice-totals-row--total {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  border-top: 2px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.tds-preview {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tds-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.tds-preview-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  color: var(--muted);
}

.tds-preview-value {
  font-weight: 600;
  font-size: 0.875rem;
}

.tds-preview-value--applicable {
  color: var(--success);
}

.tds-preview-value--not-applicable {
  color: var(--muted);
}

.tds-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.tds-preview-row--total {
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  margin-top: 4px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.search-field-input--muted {
  background: var(--border-light);
  color: var(--muted);
  cursor: not-allowed;
}

.search-field-input--error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.autocomplete-list--inline {
  position: absolute;
  z-index: 30;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .invoice-new-grid {
    grid-template-columns: 1fr;
  }

  .invoice-new-summary {
    position: static;
  }

  .invoice-meta-grid {
    grid-template-columns: 1fr;
  }

  .invoice-notes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .invoice-items-table {
    min-width: 800px;
  }

  .line-calculations {
    flex-direction: column;
  }

  .report-filter-grid {
    grid-template-columns: 1fr;
  }

  .search-field input,
  .search-field select,
  .search-field textarea {
    min-width: 100%;
  }
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.report-filter-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-filter-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2px;
}

.report-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(220, 38, 38, 0.15);
  transform: none;
  filter: none;
}

.btn-ghost:active:not(:disabled) {
  transform: none;
}

@media (max-width: 1024px) {
  .report-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .report-filter-grid {
    grid-template-columns: 1fr;
  }
}

.summary-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.workflow-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-history {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.approval-history-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.approval-history-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  background: var(--muted);
}

.approval-history-dot--approved {
  background: var(--success);
}

.approval-history-dot--rejected {
  background: var(--danger);
}

.approval-history-dot--submitted {
  background: var(--accent);
}

.approval-history-dot--resubmitted {
  background: var(--accent);
}

.approval-history-dot--cancelled {
  background: var(--muted);
}

.approval-history-content {
  flex: 1;
  min-width: 0;
}

.approval-history-action {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0 0 2px;
}

.approval-history-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.approval-history-comment {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-style: italic;
}

.taskbar-notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.taskbar-notification-btn:hover {
  background: var(--bg-subtle);
}

.taskbar-notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.taskbar-notification-dropdown {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 0;
  overflow: hidden;
}

.taskbar-notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.taskbar-notification-header strong {
  font-size: 0.95rem;
}

.taskbar-notification-mark-all {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.taskbar-notification-mark-all:hover {
  text-decoration: underline;
}

.taskbar-notification-list {
  max-height: 360px;
  overflow-y: auto;
}

.taskbar-notification-empty {
  padding: 16px;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.taskbar-notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-light);
}

.taskbar-notification-item:hover {
  background: var(--bg-subtle);
}

.taskbar-notification-item-unread {
  background: var(--accent-light);
}

.taskbar-notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-top: 6px;
  flex-shrink: 0;
}

.taskbar-notification-item-unread .taskbar-notification-dot {
  background: var(--accent);
}

.taskbar-notification-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.taskbar-notification-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.taskbar-notification-message {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.taskbar-notification-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.taskbar-notification-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.taskbar-notification-footer a {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.taskbar-notification-footer a:hover {
  text-decoration: underline;
}

.notifications-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.notifications-filters {
  display: flex;
  gap: 8px;
}

.notifications-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: box-shadow 0.15s ease;
}

.notification-item:hover {
  box-shadow: var(--shadow-sm);
}

.notification-item-unread {
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
}

.notification-item-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.notification-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  margin-top: 6px;
  flex-shrink: 0;
}

.notification-dot-active {
  background: var(--accent);
}

.notification-item-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.notification-item-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.notification-item-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-item-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.notification-item-type {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  padding: 1px 6px;
  border-radius: 4px;
}

.notification-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.preferences-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preference-category-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.preference-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preference-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.preference-item:last-child {
  border-bottom: none;
}

.preference-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.preference-toggles {
  display: flex;
  gap: 16px;
  align-items: center;
}

.preference-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.preference-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.preference-toggle-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preference-toggle-disabled input[type="checkbox"] {
  cursor: not-allowed;
}

.loading-text {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.banner-success {
  background: var(--success-bg);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-timeline-item:last-child {
  border-bottom: none;
}

.activity-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-timeline-content {
  flex: 1;
  min-width: 0;
}

.activity-timeline-title {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.activity-timeline-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

.activity-timeline-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.activity-timeline-actor {
  font-weight: 500;
}

.activity-timeline-separator {
  opacity: 0.5;
}

.activity-timeline-time {
  opacity: 0.8;
}

.activity-timeline-details {
  margin-top: 8px;
}

.activity-timeline-details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

.activity-timeline-metadata {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 8px;
  margin-top: 6px;
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.activity-timeline-load-more {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.style-settings-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@media (min-width: 1024px) {
  .style-settings-layout {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  }

  .style-preview-card {
    position: sticky;
    top: 88px;
  }
}

/* Style settings preview panel */
.style-preview-rows {
  display: flex;
  flex-direction: column;
}

.style-preview-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.style-preview-row:last-child {
  border-bottom: none;
}

.style-preview-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.style-preview-row-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.style-preview-row-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.style-preview-sample {
  display: flex;
  align-items: center;
  min-width: 0;
}

.style-preview-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.style-preview-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.style-preview-value-invalid {
  color: var(--danger);
}

.style-preview-saved {
  font-size: 0.72rem;
  color: var(--muted);
}

.style-preview-flag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.style-preview-ok {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.style-preview-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.style-sample-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.style-sample-font {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--text);
}

.style-sample-radius {
  display: inline-flex;
  align-items: center;
  padding: 18px 22px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input-wrap input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.color-input-wrap input[type="text"] {
  flex: 1;
}

.settings-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1024px) {
  .settings-layout {
    flex-direction: row;
    align-items: flex-start;
  }
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-sm);
}

.settings-nav-title {
  margin: 2px 0 8px 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.settings-nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.settings-nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.settings-nav-link-active {
  background: var(--accent-light);
  color: var(--accent);
}

.settings-nav-link-active::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.settings-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  color: var(--muted);
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.settings-nav-link:hover .settings-nav-icon {
  color: var(--accent);
}

.settings-nav-link-active .settings-nav-icon {
  background: var(--accent);
  color: #fff;
}

.settings-nav-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-nav-label {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
}

.settings-nav-desc {
  margin-top: 1px;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.9;
}

.settings-nav-link-active .settings-nav-desc {
  color: var(--accent-hover);
  opacity: 0.85;
}

.settings-content {
  flex: 1;
  min-width: 0;
}

.settings-content .section-card {
  max-width: 900px;
}

/* Settings sub-page teaser links shown on the hub. */
.settings-page-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  text-decoration: none;
  color: var(--text);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.settings-page-link:hover {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
}

.settings-page-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-page-link-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-page-link-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.settings-page-link-desc {
  margin-top: 2px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted);
}

.settings-page-link-arrow {
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.settings-page-link:hover .settings-page-link-arrow {
  transform: translateX(3px);
}

@media (max-width: 1023px) {
  .settings-nav {
    flex-direction: row;
    align-items: stretch;
    overflow-x: auto;
    padding: 10px;
    scrollbar-width: thin;
  }

  .settings-nav-title {
    display: none;
  }

  .settings-nav-link {
    flex: 0 0 auto;
  }

  .settings-nav-desc {
    display: none;
  }
}

@media (min-width: 1024px) {
  .settings-nav {
    position: sticky;
    top: 88px;
  }
}

.bg-blue-600 {
  background: #2563eb;
}

.bg-blue-700 {
  background: #1d4ed8;
}

.hover\:bg-blue-700:hover {
  background: #1d4ed8;
}

.overflow-hidden {
  overflow: hidden;
}

.hover\:text-blue-800:hover {
  color: #1e40af;
}

.disabled\:opacity-50:disabled {
  opacity: 0.5;
}

.hover\:text-yellow-800:hover {
  color: #92400e;
}

.hover\:text-red-800:hover {
  color: #991b1b;
}

.hover\:text-green-800:hover {
  color: #064e3b;
}

/* BI Dashboard filter bar and layout */
.global-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-bar-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-bar-row + .filter-bar-row {
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.filter-preset-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 140px;
}

.filter-preset-menu .form-field {
  min-width: 140px;
}

.filter-preset-menu .form-field select {
  width: 100%;
}

.date-range-selector {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: end;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(1, 171, 168, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
}

.filter-chip-clear {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.filter-chip-clear:hover {
  opacity: 1;
}

.bi-section-title {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 4px 0 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}

.bi-placeholder-card {
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.bi-dashboard-grid {
  gap: 20px;
}

/* Sales BI page specific styles */
.sales-bi-hero {
  background: linear-gradient(
    135deg,
    rgba(1, 171, 168, 0.06) 0%,
    rgba(16, 185, 129, 0.04) 100%
  );
  border: 1px solid rgba(1, 171, 168, 0.15);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 24px rgba(1, 171, 168, 0.06);
}

.sales-bi-hero .summary-card {
  box-shadow: none;
  border: none;
  background: transparent;
  backdrop-filter: none;
}

.sales-bi-hero .summary-card:hover {
  box-shadow: none;
  transform: none;
}

.sales-bi-hero .summary-label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.sales-bi-hero .summary-value {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.sales-bi-hero .sales-card-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

.sales-bi-hero .sales-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.sales-bi-section {
  border-color: rgba(226, 232, 240, 0.9);
  box-shadow: 0 2px 12px rgba(7, 33, 68, 0.04);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.sales-bi-section:hover {
  box-shadow: 0 6px 20px rgba(7, 33, 68, 0.08);
  transform: translateY(-1px);
}

.sales-bi-section .section-card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-secondary);
}

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

.sales-bi-grid-2 > * {
  min-width: 0;
}

@media (max-width: 1024px) {
  .sales-bi-grid-2 {
    grid-template-columns: 1fr;
  }
}

.sales-bi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sales-bi-table th,
.sales-bi-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.sales-bi-table th {
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-subtle);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sales-bi-table tbody tr {
  transition: background 0.15s ease;
}

.sales-bi-table tbody tr:hover {
  background: var(--bg-subtle);
}

.sales-bi-table tbody tr:last-child td {
  border-bottom: none;
}

.sales-bi-table .amount-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: nowrap;
}

.sales-bi-table .qty-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

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

.sales-comparison-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  text-align: center;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.sales-comparison-card:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.sales-comparison-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.sales-comparison-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  word-break: break-word;
}

.sales-comparison-change {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}

.sales-comparison-change-up {
  color: var(--success);
  background: var(--success-bg);
}

.sales-comparison-change-down {
  color: var(--danger);
  background: var(--danger-bg);
}

.sales-comparison-change-neutral {
  color: var(--muted);
  background: var(--bg-subtle);
}

@media (max-width: 768px) {
  .sales-comparison-grid {
    grid-template-columns: 1fr;
  }

  .sales-bi-hero .summary-value {
    font-size: 1.5rem;
  }

  .sales-bi-hero {
    padding: 16px;
  }
}

.sales-mini-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.sales-mini-card:hover {
  background: var(--border-light);
  border-color: var(--border);
}

.sales-mini-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.sales-mini-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  word-break: break-word;
}

.sales-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .sales-mini-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sales-bi-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 12px;
  letter-spacing: -0.005em;
}

.customer-receipt-page {
  max-width: 1400px;
}

.customer-receipt-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.customer-receipt-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.customer-receipt-summary {
  position: sticky;
  top: 20px;
}

.receipt-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.receipt-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.receipt-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 6px 0;
}

.receipt-totals-value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.receipt-totals-row--divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.receipt-totals-value--remaining {
  color: var(--accent);
}

.allocation-input {
  width: 160px;
  text-align: right;
}

.outstanding-invoices-table .allocation-input {
  width: 160px;
  text-align: right;
}

@media (max-width: 1024px) {
  .customer-receipt-grid {
    grid-template-columns: 1fr;
  }

  .customer-receipt-summary {
    position: static;
  }
}

/* Invoice Status Dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--draft {
  background: #94a3b8;
}

.status-dot--confirmed {
  background: var(--accent);
}

.status-dot--posted {
  background: #3b82f6;
}

.status-dot--partially_paid {
  background: var(--warning);
}

.status-dot--paid {
  background: var(--success);
}

.status-dot--cancelled,
.status-dot--void {
  background: var(--danger);
}

.status-dot--unpaid {
  background: #94a3b8;
}

.status-dot--overdue {
  background: var(--danger);
}

.status-dot--none {
  background: #e2e8f0;
}

/* Invoice Status Indicator */
.invoice-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Invoice Status Grid */
.invoice-status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Invoice Detail Header */
.invoice-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.invoice-header-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Invoice Customer */
.invoice-customer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.invoice-customer-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.invoice-customer-address {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.invoice-customer-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.invoice-customer-meta span {
  font-weight: 500;
  color: var(--muted);
}

/* Invoice Meta Grid */
.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.invoice-meta-grid--single {
  grid-template-columns: 1fr;
}

.invoice-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invoice-meta-item span:first-child {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.invoice-meta-item span:last-child {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.invoice-meta-item--wide {
  grid-column: 1 / -1;
}

/* Invoice Totals */
.invoice-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.9rem;
}

.invoice-totals-row--divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
  padding-top: 10px;
}

.invoice-totals-row--gross {
  font-weight: 600;
  font-size: 1rem;
}

.invoice-totals-row--total {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.invoice-totals-row--balance {
  font-weight: 600;
  color: var(--accent);
}

/* Invoice Detail Grid */
.invoice-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* Action Button Group */
.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.action-group--primary {
  gap: 10px;
}

.action-group--secondary {
  gap: 8px;
}

.action-group--danger {
  margin-left: auto;
}

/* Invoice Filters */
.invoice-filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.invoice-filters .search-field {
  flex: 1;
  min-width: 160px;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.summary-cards--half {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.summary-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.summary-card-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-card-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.amount-high {
  color: var(--danger);
}

.amount-low {
  color: var(--success);
}

/* Invoice Table Enhancements */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.invoice-table th,
.invoice-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.invoice-table th {
  background: var(--border-light);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.invoice-table tbody tr {
  transition: background 0.15s ease;
}

.invoice-table tbody tr:hover {
  background: var(--border-light);
}

.invoice-table .table-cell-strong {
  font-weight: 600;
  color: var(--text);
}

/* Responsive */
@media (max-width: 1024px) {
  .invoice-detail-grid {
    grid-template-columns: 1fr;
  }

  .invoice-status-grid {
    grid-template-columns: 1fr;
  }

  .invoice-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .invoice-new-grid {
    grid-template-columns: 1fr;
  }

  .invoice-new-summary {
    position: static;
  }
}

@media (max-width: 768px) {
  .invoice-meta-grid {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .invoice-filters {
    flex-direction: column;
  }

  .invoice-filters .search-field {
    width: 100%;
    min-width: auto;
  }
}

/* Invoice Form Enhancements */
.invoice-form-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.invoice-form-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.invoice-form-sidebar {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.invoice-items-table .input-number {
  width: 90px;
  text-align: right;
}

.invoice-items-table .input-select {
  width: 120px;
}

.invoice-items-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.invoice-items-table .item-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Purchase Information Grid */
.purchase-info-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.purchase-info-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required-indicator {
  color: var(--danger);
  font-size: 0.75rem;
}

.form-field--required .form-label {
  color: var(--text);
}

.nepali-date-input {
  width: 100%;
}

.nepali-date-input .form-field {
  width: 100%;
}

.nepali-date-input .nepali-date-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.nepali-date-input .form-field-label {
  display: none;
}

.nepali-date-input .form-field {
  min-width: 0;
}

.nepali-date-input .form-field input,
.nepali-date-input .form-field select {
  min-width: 0;
  width: 100%;
}

.date-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

.form-error--full {
  grid-column: 1 / -1;
  margin-top: -8px;
  margin-bottom: 8px;
}

/* form-field as div wrapper */
.form-field > .nepali-date-input {
  margin-top: 0;
}

@media (max-width: 768px) {
  .purchase-info-row {
    grid-template-columns: 1fr;
  }

  .nepali-date-input .nepali-date-fields {
    grid-template-columns: 1fr;
  }
}

/* Empty state for tables */
.empty-state {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 24px;
}

/* Loading state */
.loading {
  text-align: center;
  color: var(--muted);
  padding: 40px;
  font-size: 0.95rem;
}

/* Button Enhancements */
.btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-group--primary {
  gap: 10px;
}

.btn-group--secondary {
  gap: 8px;
}

/* Action bar in detail pages */
.invoice-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.invoice-action-bar .action-group {
  margin-left: auto;
}

/* Payment Progress */
.payment-progress {
  margin-top: 16px;
}

.payment-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.payment-progress-bar {
  background: var(--border-color, var(--border));
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}

.payment-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.payment-progress-fill--partial {
  background: var(--warning);
}

.payment-progress-fill--overdue {
  background: var(--danger);
}

.payment-progress-footer {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ==========================================================================
   Reports design system
   Shared building blocks for the /reports pages: filter bar, meta strip,
   stat grids, report tables, empty states, statement link cards, print.
   ========================================================================== */

.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.report-filters-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
  flex: 1 1 auto;
  min-width: 0;
}

.report-filters-fields > .form-field,
.report-filters-fields > .fy-selector {
  flex: 0 1 200px;
  min-width: 160px;
  margin: 0;
}

.report-filters-fields > .form-field > span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.report-filters-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  margin: 0;
}

.report-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.report-meta-label {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.report-meta-value {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.stat-grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.report-table-section {
  margin-bottom: 20px;
}

.report-table-section:last-child {
  margin-bottom: 0;
}

.report-table-section-title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.report-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 16px;
  text-align: center;
}

.report-empty-state-text {
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.report-nested-table {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
}

.report-nested-table .transaction-table th {
  position: static;
  background: rgba(227, 238, 243, 0.7);
}

.report-nested-table .transaction-table th,
.report-nested-table .transaction-table td {
  padding: 9px 14px;
  font-size: 0.825rem;
}

.report-nested-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.report-export-buttons {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.report-link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.report-link-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.report-link-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.report-link-card-arrow {
  color: var(--accent);
  font-weight: 700;
}

.report-link-card-desc {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

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

.report-chart-grid--single {
  grid-template-columns: 1fr;
}

.report-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 24px;
}

.report-detail-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.report-detail-grid strong {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.report-detail-grid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-word;
}

.report-indent {
  padding-left: 16px;
}

@media (max-width: 900px) {
  .report-chart-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid--2,
  .stat-grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .report-filters {
    padding: 14px 16px;
  }

  .report-filters-fields > .form-field,
  .report-filters-fields > .fy-selector {
    flex: 1 1 100%;
  }

  .report-filters-actions {
    margin-left: 0;
    width: 100%;
  }

  .report-filters-actions .btn {
    flex: 1 1 auto;
  }
}

/* Printable report output */
@media print {
  .app-topbar,
  .sb-peek,
  .sb-drawer,
  .sb-backdrop,
  .report-filters,
  .report-export-buttons,
  .report-tabs,
  .page-actions {
    display: none !important;
  }

  .app-main {
    padding: 0 !important;
    max-width: none !important;
  }

  .page {
    gap: 12px;
  }

  .section-card,
  .panel,
  .summary-card {
    box-shadow: none !important;
    border-color: #d7e3ea !important;
    background: #fff !important;
    break-inside: avoid;
  }

  .transaction-table {
    min-width: 0 !important;
    font-size: 0.8rem;
  }

  .transaction-table th {
    position: static !important;
  }
}

@property --o1 {
  syntax: "<color>";
  inherits: true;
  initial-value: #000;
}
@property --o2 {
  syntax: "<color>";
  inherits: true;
  initial-value: #000;
}
@property --o3 {
  syntax: "<color>";
  inherits: true;
  initial-value: #000;
}
@property --osk1 {
  syntax: "<color>";
  inherits: true;
  initial-value: #0f8f9c;
}
@property --osk2 {
  syntax: "<color>";
  inherits: true;
  initial-value: #2fb8a8;
}
@property --osk3 {
  syntax: "<color>";
  inherits: true;
  initial-value: #7fdcc0;
}
@property --oorb {
  syntax: "<color>";
  inherits: true;
  initial-value: #fff;
}
@property --oglow {
  syntax: "<color>";
  inherits: true;
  initial-value: #fff;
}
@property --ostar {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --ocloud {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --osx {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 30%;
}
@property --osy {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

.ocean-bg {
  position: absolute;
  inset: 0;
  transition:
    --o1 0.9s,
    --o2 0.9s,
    --o3 0.9s,
    --osk1 0.9s,
    --osk2 0.9s,
    --osk3 0.9s,
    --oorb 0.9s,
    --oglow 0.9s,
    --ostar 0.9s,
    --ocloud 0.9s,
    --osx 1.1s cubic-bezier(0.4, 0, 0.2, 1),
    --osy 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.ocean-bg > * {
  position: absolute;
  pointer-events: none;
}

/* Layers: sky, bloom, haze, stars 0 Ã‚Â· rays/birds/clouds 1 Ã‚Â· sun & moon 2 Ã‚Â· waves, grain, scrim 3 */
.ocean-sky {
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    135deg,
    var(--osk1),
    var(--osk2) 60%,
    var(--osk3)
  );
}
.ocean-bloom {
  inset: 0;
  z-index: 0;
  background: radial-gradient(
    circle at var(--osx) var(--osy),
    var(--oglow),
    transparent 50%
  );
  opacity: 0.55;
  mix-blend-mode: screen;
}
.ocean-neb {
  inset: -10px;
  z-index: 0;
  opacity: calc(var(--ostar) * 0.6);
  filter: blur(8px);
  animation: ocean-neb 14s ease-in-out infinite alternate;
  background:
    radial-gradient(
      40% 70% at 82% 78%,
      rgba(53, 208, 160, 0.42),
      transparent 70%
    ),
    radial-gradient(
      34% 60% at 95% 20%,
      rgba(140, 110, 255, 0.34),
      transparent 70%
    ),
    radial-gradient(
      30% 55% at 58% 95%,
      rgba(60, 140, 255, 0.24),
      transparent 70%
    );
}
@keyframes ocean-neb {
  to {
    transform: translateX(-18px) scale(1.06);
  }
}

/* stars, shooting stars, constellation (only visible at evening and night) */
.ocean-stars {
  inset: 0 0 28% 0;
  z-index: 0;
  opacity: var(--ostar);
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}
.ocean-stars i {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: var(--o);
  animation: ocean-tw var(--d) ease-in-out var(--dl) infinite alternate;
}
.ocean-stars i.big {
  box-shadow: 0 0 7px 1px rgba(255, 255, 255, 0.8);
}
@keyframes ocean-tw {
  from {
    opacity: calc(var(--o) * 0.25);
    transform: scale(0.75);
  }
  to {
    opacity: var(--o);
    transform: scale(1.2);
  }
}
.ocean-stars b {
  position: absolute;
  width: 90px;
  height: 1.5px;
  background: linear-gradient(90deg, #fff, transparent);
  opacity: 0;
  transform-origin: left center;
  animation: ocean-shoot var(--sd) linear var(--sl) infinite;
}
@keyframes ocean-shoot {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(-26deg);
  }
  2% {
    opacity: 1;
  }
  9% {
    opacity: 0;
    transform: translate(-190px, 100px) rotate(-26deg);
  }
  100% {
    opacity: 0;
    transform: translate(-190px, 100px) rotate(-26deg);
  }
}
.ocean-const {
  z-index: 0;
  left: 50%;
  top: 22%;
  width: 150px;
  height: 84px;
  opacity: calc(var(--ostar) * 0.85);
}
.ocean-const polyline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.ocean-const circle {
  fill: #fff;
}

.ocean-rays {
  inset: 0;
  z-index: 1;
  opacity: calc((1 - var(--ostar)) * 0.22);
  mix-blend-mode: screen;
  background: conic-gradient(
    from 200deg at var(--osx) var(--osy),
    transparent 0 8deg,
    rgba(255, 255, 255, 0.55) 12deg,
    transparent 18deg 30deg,
    rgba(255, 255, 255, 0.4) 34deg,
    transparent 40deg 56deg,
    rgba(255, 255, 255, 0.45) 60deg,
    transparent 66deg 360deg
  );
  -webkit-mask-image: radial-gradient(
    circle at var(--osx) var(--osy),
    #000,
    transparent 70%
  );
  mask-image: radial-gradient(
    circle at var(--osx) var(--osy),
    #000,
    transparent 70%
  );
}
.ocean-bg[data-orb="moon"] .ocean-rays {
  display: none;
}

.ocean-birds {
  z-index: 1;
  top: 14%;
  left: -12%;
  width: 90px;
  height: 30px;
  opacity: calc((1 - var(--ostar)) * 0.75);
  animation: ocean-fly 38s linear infinite;
}
.ocean-birds path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes ocean-fly {
  to {
    transform: translate(1150px, -18px);
  }
}

/* clouds */
.ocean-cloud {
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  filter: blur(9px);
  opacity: var(--ocloud);
  animation: ocean-drift linear infinite;
}
.ocean-cloud::after {
  content: "";
  position: absolute;
  left: 22%;
  top: -70%;
  width: 46%;
  height: 150%;
  border-radius: 50%;
  background: inherit;
}
.oc1 {
  z-index: 1;
  width: 130px;
  top: 24%;
  left: -20%;
  animation-duration: 110s;
}
.oc2 {
  z-index: 1;
  width: 90px;
  top: 66%;
  left: -20%;
  animation-duration: 150s;
  animation-delay: -70s;
}
.oc3 {
  z-index: 2;
  width: 190px;
  height: 14px;
  top: 50%;
  left: -24%;
  animation-duration: 125s;
  animation-delay: -35s;
  opacity: calc(var(--ocloud) * 0.8);
}
@keyframes ocean-drift {
  to {
    transform: translateX(1700px);
  }
}

/* sun and moon */
.ocean-orb {
  z-index: 2;
  left: var(--osx);
  top: var(--osy);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.7s;
}
.ocean-sun {
  width: 58px;
  height: 58px;
  background: radial-gradient(circle at 40% 35%, #fff, var(--oorb) 72%);
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, 0.12),
    0 0 54px 20px var(--oglow);
}
.ocean-moon {
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at 35% 30%, #fff, #dcecff 55%, #b9d2ea);
  box-shadow:
    0 0 0 13px rgba(190, 220, 255, 0.07),
    0 0 0 30px rgba(190, 220, 255, 0.04),
    0 0 40px 10px var(--oglow);
}
.ocean-moon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 62% 38%,
      rgba(120, 150, 180, 0.35) 0 7px,
      transparent 8px
    ),
    radial-gradient(
      circle at 40% 66%,
      rgba(120, 150, 180, 0.3) 0 5px,
      transparent 6px
    ),
    radial-gradient(
      circle at 72% 72%,
      rgba(120, 150, 180, 0.25) 0 4px,
      transparent 5px
    );
}
.ocean-bg[data-orb="sun"] .ocean-sun,
.ocean-bg[data-orb="moon"] .ocean-moon {
  opacity: 1;
}

/* horizon glow and waves */
.ocean-hz {
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%;
  opacity: 0.3;
  background: linear-gradient(0deg, var(--oglow), transparent);
  mix-blend-mode: screen;
}
.ocean-scene {
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 64%;
}
.ocean-scene .o-a {
  fill: var(--o1);
}
.ocean-scene .o-b {
  fill: var(--o2);
}
.ocean-scene .o-c {
  fill: var(--o3);
}
.ocean-wave {
  animation: ocean-wave linear infinite;
}
@keyframes ocean-wave {
  to {
    transform: translateX(-245px);
  }
}
.ocean-boat {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: ocean-bob 4s ease-in-out infinite;
}
@keyframes ocean-bob {
  50% {
    transform: translateY(-2px) rotate(2deg);
  }
}

/* finishing layers */
.ocean-grain {
  inset: 0;
  z-index: 3;
  opacity: 0.1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ocean-scrim {
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(
      90deg,
      rgba(0, 18, 24, 0.36),
      rgba(0, 18, 24, 0.1) 55%,
      transparent
    ),
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.16));
}

@media (max-width: 600px) {
  .ocean-const {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ocean-bg *,
  .ocean-bg {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------------------
   Fiscal Years (settings/fiscal-years)
   --------------------------------------------------------------------------- */

.badge-status-open {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-status-closing {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-status-closed {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-status-reopened {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.fy-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fy-filter label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.fy-filter select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.fy-filter select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.fiscal-table th.num,
.fiscal-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fiscal-table td.fiscal-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.fiscal-table td.fiscal-actions {
  white-space: nowrap;
}

.fiscal-table td.fiscal-actions .btn + .btn {
  margin-left: 8px;
}

/* Closing wizard modal */

.fy-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.fy-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text);
}

.fy-modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.fy-modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.fy-modal-close:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.fy-stepper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.fy-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fy-step-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--border-light);
}

.fy-step--active .fy-step-bubble {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(1, 171, 168, 0.3);
}

.fy-step--done .fy-step-bubble {
  background: var(--success-bg);
  border-color: #a7f3d0;
  color: #065f46;
}

.fy-step-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.fy-step--active .fy-step-label {
  color: var(--accent-hover);
  font-weight: 600;
}

.fy-step--done .fy-step-label {
  color: var(--text-secondary);
}

.fy-step-connector {
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: var(--border-light);
  margin: 0 2px;
}

.fy-step-connector--done {
  background: var(--success);
}

.fy-wizard-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fy-wizard-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fy-wizard-lead {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.fy-wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.fy-wizard-footer--end {
  justify-content: flex-end;
}

.fy-callout {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid transparent;
}

.fy-callout--danger {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.fy-callout--warning {
  background: var(--warning-bg);
  border-color: #fde68a;
}

.fy-callout--success {
  background: var(--success-bg);
  border-color: #a7f3d0;
}

.fy-callout--info {
  background: var(--accent-light);
  border-color: var(--border-light);
}

.fy-callout p {
  margin: 0 0 8px;
  font-size: 0.875rem;
  line-height: 1.6;
}

.fy-callout p:last-child {
  margin-bottom: 0;
}

.fy-callout-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.fy-callout--danger .fy-callout-title,
.fy-callout--danger p strong {
  color: #991b1b;
}

.fy-callout--warning .fy-callout-title {
  color: #92400e;
}

.fy-callout--success .fy-callout-title {
  color: #065f46;
}

.fy-callout--info .fy-callout-title {
  color: var(--accent-hover);
}

.fy-callout-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.fy-callout--danger .fy-callout-list {
  color: #b91c1c;
}

.fy-callout--warning .fy-callout-list {
  color: #92400e;
}

.fy-callout--success .fy-callout-list {
  color: #065f46;
}

.fy-callout--info .fy-callout-list {
  color: var(--text-secondary);
}

.fy-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.fy-check-tile {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
  border: 1px solid var(--border-light);
  background: var(--surface);
}

.fy-check-tile-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.fy-check-tile-label {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.fy-check-tile--danger {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.fy-check-tile--danger .fy-check-tile-value {
  color: #b91c1c;
}

.fy-check-tile--warning {
  background: var(--warning-bg);
  border-color: #fde68a;
}

.fy-check-tile--warning .fy-check-tile-value {
  color: #b45309;
}

.fy-check-tile--success {
  background: var(--success-bg);
  border-color: #a7f3d0;
}

.fy-check-tile--success .fy-check-tile-value {
  color: #065f46;
}

.fy-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.fy-preview-tile {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface);
  padding: 14px 16px;
}

.fy-preview-tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.fy-preview-tile-value {
  margin-top: 4px;
  font-size: 0.92rem;
  font-weight: 600;
}

.fy-preview-tile--ok {
  background: var(--success-bg);
  border-color: #a7f3d0;
}

.fy-preview-tile--ok .fy-preview-tile-value {
  color: #065f46;
}

.fy-preview-tile--bad {
  background: var(--danger-bg);
  border-color: #fecaca;
}

.fy-preview-tile--bad .fy-preview-tile-value {
  color: #b91c1c;
}

.fy-preview-tile--warn {
  background: var(--warning-bg);
  border-color: #fde68a;
}

.fy-preview-tile--warn .fy-preview-tile-value {
  color: #92400e;
}

.fy-netprofit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(1, 171, 168, 0.1), rgba(16, 185, 129, 0.06));
  border: 1px solid var(--border-light);
}

.fy-netprofit-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.fy-netprofit-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-hover);
}

@media (max-width: 640px) {
  .fy-stepper {
    gap: 4px;
  }

  .fy-step-label {
    font-size: 0.75rem;
  }

  .fy-step-connector {
    width: 16px;
  }

  .fy-filter {
    width: 100%;
  }

  .fy-filter select {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fy-modal-close,
  .fy-filter select {
    transition-duration: 0.01ms;
  }
}

/* Global search page */
.search-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 880px;
  margin: 0 auto;
  animation: fadeIn 300ms ease-out;
}

.search-page-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: linear-gradient(
    135deg,
    rgba(1, 171, 168, 0.08),
    rgba(16, 185, 129, 0.05)
  );
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.search-page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.search-page-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-page-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.search-page-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.search-page-input::placeholder {
  color: #94a3b8;
}

.search-page-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-page-filter {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.search-page-filter:hover {
  color: var(--accent);
  background: var(--accent-light);
  border-color: rgba(1, 171, 168, 0.35);
}

.search-page-filter-active,
.search-page-filter-active:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #ffffff;
}

.search-page-results {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-page-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-page-count strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.search-page-group {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.search-page-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.search-page-group-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.search-page-group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.search-page-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.search-page-item:hover {
  border-color: rgba(1, 171, 168, 0.4);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.search-page-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.search-page-item-subtitle {
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-hover);
}

.search-page-item-description {
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.search-page-mark {
  padding: 0 2px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent-hover);
  font-weight: 700;
}

.search-page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-page-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.search-page-error {
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.875rem;
  text-align: center;
}

.search-page-empty {
  padding: 40px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.search-page-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
}

.search-page-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.search-page-empty-tips {
  display: inline-block;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
  text-align: left;
}

@media (max-width: 640px) {
  .search-page-header {
    padding: 18px 16px;
  }

  .search-page-form {
    flex-direction: column;
    align-items: stretch;
  }

  .search-page-form .btn {
    width: 100%;
  }

  .search-page-group-items {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-page {
    animation: none;
  }

  .search-page-item,
  .search-page-spinner {
    animation: none;
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   Document Settings (settings/documents)
   --------------------------------------------------------------------------- */

.doc-settings-table th.num,
.doc-settings-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.doc-settings-table td.doc-settings-type {
  white-space: nowrap;
}

.doc-settings-type-label {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.doc-settings-type-code {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.doc-settings-pattern {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.doc-settings-actions .btn + .btn {
  margin-left: 8px;
}

.doc-settings-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.doc-settings-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
}

.doc-settings-empty-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.doc-settings-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  align-self: end;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.doc-settings-preview-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.doc-settings-soon {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.doc-settings-soon-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-hover);
  white-space: nowrap;
}

.doc-settings-soon .form-note {
  flex: 1 1 240px;
  margin-bottom: 0;
}

/* ===== Profile page ===== */
.profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.profile-identity-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 10px 24px -8px rgba(1, 171, 168, 0.55);
}

.profile-identity-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.profile-identity-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  font-family: var(--font-display);
  overflow-wrap: anywhere;
}

.profile-identity-email {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profile-role-badge {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(1, 171, 168, 0.28);
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.profile-field-wide {
  grid-column: 1 / -1;
}

.profile-form .form-error {
  margin: 0;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-readonly {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.profile-readonly:hover {
  border-color: var(--border);
}

.profile-readonly-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.profile-readonly-value {
  font-size: 0.9375rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.profile-field-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
}

.profile-field-note svg {
  flex-shrink: 0;
  margin-top: 3px;
  opacity: 0.85;
}

.profile-required {
  color: var(--danger);
  font-weight: 700;
}

.profile-section-note {
  margin: 0 0 14px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

.profile-security-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-light);
}

.profile-security-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-security-text svg {
  color: var(--accent);
  flex-shrink: 0;
}

.profile-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.profile-form-hint {
  margin-right: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.profile-modal-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent-hover);
}

.profile-modal-heading {
  min-width: 0;
}

.profile-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.profile-modal-subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 640px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-identity {
    padding: 18px;
  }

  .profile-form-hint {
    display: none;
  }

  .profile-form-actions .btn {
    flex: 1;
  }
}


/* ---------- shell spacing: responsive (kept last so it wins over the base rules) ---------- */
@media (max-width: 768px) {
  .app-main {
    padding: 20px 16px 40px;
  }

  .welcome-banner-wrap {
    padding: 0 16px;
  }

  .welcome-banner-gradient {
    border-radius: 22px;
  }

  .app-footer {
    padding: 18px 16px;
  }

  .app-footer-links {
    gap: 10px 14px;
  }
}

@media (max-width: 480px) {
  .app-main {
    padding: 16px 12px 32px;
  }

  .welcome-banner-wrap {
    padding: 0 12px;
  }

  .app-footer {
    padding: 16px 12px;
  }

  .app-footer-links a {
    font-size: 0.8rem;
  }
}
/* ---------- reports: responsive refinements ---------- */
@media (max-width: 860px) {
  /* The sticky topbar is taller on tablets/phones, so let report headers flow
     normally instead of pinning them to the viewport edge behind the bar. */
  .transaction-table th {
    position: static;
  }

  .section-card {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .section-card {
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-actions .btn {
    flex: 1 1 auto;
  }

  .page-back-link {
    padding: 5px 12px 5px 9px;
  }

  .report-meta {
    gap: 12px 20px;
  }

  /* Tabs become a swipeable strip instead of stacking into several rows. */
  .report-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
  }

  .report-tabs::-webkit-scrollbar {
    display: none;
  }

  .report-tab {
    flex: none;
    white-space: nowrap;
    padding: 9px 16px;
  }

  .transaction-table {
    min-width: 520px;
  }

  .transaction-table th,
  .transaction-table td {
    padding: 10px 12px;
  }

  .empty-state,
  .loading {
    padding: 32px 16px;
  }

  .report-empty-state {
    padding: 22px 12px;
  }
}

@media (max-width: 560px) {
  /* Two stat cards per row on larger phones, one on small ones. */
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .stat-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .summary-value {
    font-size: 1.15rem;
  }

  .report-table-section-title {
    font-size: 0.75rem;
  }
}
/* ---------- sales: responsive refinements ---------- */
/* Layout styles that were referenced by the sales pages but never defined. */
.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.customer-statement-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
}

.statement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.summary-card--balance {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.summary-card--overdue {
  border-color: var(--warning);
}

/* Untitled page sections get the same vertical rhythm as .page. */
.page-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 768px) {
  /* Nowrap cells already make wide invoice tables scroll inside .table-wrap;
     tighter cells buy back horizontal room on phones. */
  .invoice-table th,
  .invoice-table td {
    padding: 12px;
  }

  .customer-statement-header {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  /* A 400px minimum search field cannot fit on a phone. */
  .customer-search input {
    min-width: 0;
  }

  .statement-summary {
    grid-template-columns: 1fr;
  }
}
/* ---------- purchases: responsive refinements ---------- */
/* Several classes used by the purchase forms/pages had no styles at all, so
   their controls rendered as bare browser inputs and grids stacked. */

/* Form group: label + bare input/select/textarea (used by purchase returns,
   supplier payments and fixed-asset forms). */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group > label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-subtle);
}

.form-input,
.form-help,
.field-error,
.text-muted {
  min-width: 0;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.field-error {
  color: var(--danger);
  font-size: 0.75rem;
}

.text-muted {
  color: var(--muted);
}

/* Label/value pairs (purchase detail, payment detail, audit info). */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 20px;
  align-items: start;
}

.detail-audit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-notes {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Totals row (purchase return form). */
.totals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: flex-end;
}

.total-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

.total-item strong {
  font-size: 1.05rem;
  color: var(--text);
}

.total-item--grand strong {
  font-size: 1.25rem;
  color: var(--accent);
}

/* Page wrappers used instead of .page on purchase list/receipt pages. */
.page-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

/* Tabs (opening balances page). */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.tab:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.tab-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Autocomplete wrapper (goods receipt form) holds an absolutely positioned list. */
.autocomplete-field {
  position: relative;
  min-width: 0;
}

/* Goods receipt rows use bare <label><span/><input/></label> with no helper
   class, which rendered as unstyled browser controls. */
.form-grid > label:not([class]) > span {
  display: block;
  margin-bottom: 2px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-grid > label:not([class]) > input,
.form-grid > label:not([class]) > select,
.form-grid > label:not([class]) > textarea {
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.form-grid > label:not([class]) > input:focus,
.form-grid > label:not([class]) > select:focus,
.form-grid > label:not([class]) > textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Compact number input inside allocation tables. */
.input-allocation {
  width: 100%;
  min-width: 72px;
  max-width: 140px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: right;
}

.input-allocation:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Clickable table rows carrying a link in the first cell. */
.table-row-clickable {
  cursor: pointer;
}

.table-row-clickable:hover {
  background: var(--bg-subtle);
}

.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-hover);
}

@media (max-width: 640px) {
  .totals-row {
    justify-content: flex-start;
  }

  .total-item {
    min-width: 96px;
    text-align: left;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
/* ---------- expenses: responsive refinements ---------- */
/* The expense detail/payment/reject/upload modals (and the fixed-asset dialogs)
   use a ".modal-overlay > .modal" structure that had no styles, so they rendered
   inline in the page with no backdrop, scroll handling, or max height. */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fadeIn 200ms ease-out;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal--wide {
  max-width: 820px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.modal-close {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.modal-close:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-close:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
}

.modal-body > form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* Payment preview + summary panels. */
.payment-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.payment-preview-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.payment-preview-row--total {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--text);
}

.payment-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.payment-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.payment-summary-row--net {
  font-weight: 700;
  color: var(--text);
}

.payment-summary-row--status {
  margin-top: 2px;
}

.payment-summary-divider {
  height: 1px;
  margin: 2px 0;
  background: var(--border);
}

.payment-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.payment-summary-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
}

/* Posted journal info. */
.posted-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.posted-info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Tax detail blocks. */
.tax-detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tax-detail-heading {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.tax-detail-rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tax-detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.tax-detail-row + .tax-detail-row {
  border-top: 1px solid var(--border-light);
}

.tax-detail-row--highlight {
  font-weight: 700;
  color: var(--text);
}

.tax-detail-totals {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

/* Attachments. */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attachment-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.attachment-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 260px;
}

.attachment-icon {
  flex: none;
  font-size: 1.25rem;
  line-height: 1;
}

.attachment-filename {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.attachment-meta {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  max-height: 60vh;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.attachment-preview-image {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
}

.attachment-preview-pdf {
  width: 100%;
  height: 60vh;
  border: 0;
}

/* Small helpers used by the expense pages. */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.approval-history-dot--posted {
  background: var(--accent);
}

.attachment-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.form-field-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  word-break: break-word;
}

.form-field-value {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.invoice-new-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.payment-history-table {
  width: 100%;
  overflow-x: auto;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    padding: 20px 16px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .modal-header,
  .modal-body {
    padding: 14px 16px;
  }

  /* Primary action first when the buttons stack. */
  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .attachment-item-main {
    flex-basis: 100%;
  }

  .attachment-actions {
    width: 100%;
  }

  .attachment-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .payment-preview,
  .posted-info,
  .tax-detail-totals {
    padding: 12px;
  }

  .tax-detail-row {
    padding: 10px 12px;
  }

  .payment-summary-actions {
    margin-top: 10px;
  }
}

/* ---------- daily: responsive refinements ---------- */
/* The daily pages themselves already collapse (daily-grid, ledger-layout,
   day-stepper, daily-date-picker all have rules); this covers the entry popup
   used inside Daily Transactions and the backdrop padding on phones. */
.entry-card-popup {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

@media (max-width: 640px) {
  .modal-backdrop--centered,
  .modal-backdrop {
    padding: 12px;
  }

  .entry-card-popup {
    max-height: calc(100vh - 24px);
    padding: 18px 16px;
  }

  .day-btn {
    flex: 1 1 45%;
  }
}
/* ---------- organizations: responsive refinements ---------- */
/* .page-header-meta ("N records" in the page header) had no styles. */
.page-header-meta {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

@media (max-width: 768px) {
  /* The action column was a fixed 220px, which starved the other columns on
     phones; let it size to its buttons instead. */
  .col-actions {
    width: auto;
    min-width: 150px;
  }
}

@media (max-width: 640px) {
  .col-actions {
    min-width: 0;
    width: 100%;
  }

  .col-actions.actions-cell .btn {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}
/* ---------- receivables/payables: responsive refinements ---------- */
/* The card header put a wrapping org name next to a nowrap amount block, so
   long names were squeezed into a narrow column on narrow screens. */
.aging-card-header {
  flex-wrap: wrap;
}

.aging-card-header > *,
.aging-card-item {
  min-width: 0;
}

.aging-card-value {
  word-break: break-word;
}

/* ---------- banking: responsive refinements ---------- */
/* .table-wrapper is used in 19 places (banking reconciliation/adjustments,
   opening balances, BI charts) to wrap .table, which has min-width: 640px.
   Without this rule those tables overflow their card on any narrow screen. */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Compact select used in reconciliation action cells. */
.form-select-sm {
  min-width: 140px;
  padding: 8px 28px 8px 10px;
  font-size: 0.8125rem;
}

.form-success {
  margin: 0 0 16px;
  color: var(--success);
  font-size: 0.875rem;
}

.text-secondary {
  color: var(--text-secondary);
}

/* Filter grid (banking transfers). */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
  align-items: end;
}

/* Match/allocation selects inside table cells should not widen the table. */
.rec-table-actions .form-select {
  min-width: 140px;
}

@media (max-width: 860px) {
  /* Same reasoning as .transaction-table th: the sticky topbar would cover it. */
  .table th {
    position: static;
  }
}

@media (max-width: 640px) {
  /* Allocation inputs are a fixed 160px, which forces extra horizontal scroll
     on phones; let them shrink down to a usable width. */
  .allocation-input,
  .outstanding-invoices-table .allocation-input {
    width: 100%;
    min-width: 96px;
    max-width: 160px;
  }

  .rec-table-actions .form-select {
    width: 100%;
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }
}
/* ---------- inventory: responsive refinements ---------- */
/* .data-table-wrap (inventory dashboard) had no styles, so it did not clip or
   scroll its table; mirror the .table-wrap behaviour. */
.data-table-wrap {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  /* Action buttons inside squeezed data-table cells: full-width buttons with
     12px padding make every row tall on phones. */
  .actions-cell {
    gap: 4px;
  }

  .actions-cell .btn {
    padding: 8px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .actions-cell .btn-small {
    padding: 7px 10px;
    font-size: 0.75rem;
  }
}
/* ---------- payroll: responsive refinements ---------- */
/* Several payroll pages use a .card/.card-body pair and a .label/.select/.input
   control trio that had no styles, so cards were unpadded and selects/labels
   fell back to raw browser defaults. */

.card-body {
  padding: 20px 24px;
}

/* Bootstrap-style alerts (payroll adjustments, banking statement pages). */
.alert {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert-danger {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: #991b1b;
}

.alert-success {
  background: var(--success-bg);
  border-color: #a7f3d0;
  color: #065f46;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.alert-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

/* Page wrapper used by the adjustment pages (same rhythm as .page). */
.page-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.label {
  display: block;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select {
  min-width: 140px;
  max-width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

/* Inside a form field the control fills the column and must keep chevron room. */
.form-field .select {
  width: 100%;
  padding: 0 34px 0 12px;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--bg-subtle);
}

/* Checkbox rows: label beside control instead of stacked. */
.form-field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.form-field-checkbox > span {
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
}

.form-field-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  padding: 0;
  accent-color: var(--accent);
}

/* Three-up field grid (salary structure component/assignment rows). */
.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-divider {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: var(--border);
}

/* Metric cards (payroll reports). */
.metric-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.metric-value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

@media (max-width: 900px) {
  .form-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .card-body {
    padding: 16px;
  }

  .section-divider {
    margin: 16px 0;
  }

  .metric-value {
    font-size: 1.1rem;
  }
}@property --o1 { syntax: '<color>'; inherits: true; initial-value: #000; }
@property --o2 { syntax: '<color>'; inherits: true; initial-value: #000; }
@property --o3 { syntax: '<color>'; inherits: true; initial-value: #000; }
@property --osk1 { syntax: '<color>'; inherits: true; initial-value: #0f8f9c; }
@property --osk2 { syntax: '<color>'; inherits: true; initial-value: #2fb8a8; }
@property --osk3 { syntax: '<color>'; inherits: true; initial-value: #7fdcc0; }
@property --oorb { syntax: '<color>'; inherits: true; initial-value: #fff; }
@property --oglow { syntax: '<color>'; inherits: true; initial-value: #fff; }
@property --ostar { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --ocloud { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --osx { syntax: '<percentage>'; inherits: true; initial-value: 30%; }
@property --osy { syntax: '<percentage>'; inherits: true; initial-value: 50%; }

.ocean-bg {
  position: absolute;
  inset: 0;
  transition:
    --o1 .9s, --o2 .9s, --o3 .9s,
    --osk1 .9s, --osk2 .9s, --osk3 .9s,
    --oorb .9s, --oglow .9s, --ostar .9s, --ocloud .9s,
    --osx 1.1s cubic-bezier(.4, 0, .2, 1), --osy 1.1s cubic-bezier(.4, 0, .2, 1);
}
.ocean-bg > * { position: absolute; pointer-events: none; }

/* Layers: sky, bloom, haze, stars 0 · rays/birds/clouds 1 · sun & moon 2 · waves, grain, scrim 3 */
.ocean-sky {
  inset: 0; z-index: 0;
  background: linear-gradient(135deg, var(--osk1), var(--osk2) 60%, var(--osk3));
}
.ocean-bloom {
  inset: 0; z-index: 0;
  background: radial-gradient(circle at var(--osx) var(--osy), var(--oglow), transparent 50%);
  opacity: .55; mix-blend-mode: screen;
}
.ocean-neb {
  inset: -10px; z-index: 0;
  opacity: calc(var(--ostar) * .6);
  filter: blur(8px);
  animation: ocean-neb 14s ease-in-out infinite alternate;
  background:
    radial-gradient(40% 70% at 82% 78%, rgba(53,208,160,.42), transparent 70%),
    radial-gradient(34% 60% at 95% 20%, rgba(140,110,255,.34), transparent 70%),
    radial-gradient(30% 55% at 58% 95%, rgba(60,140,255,.24), transparent 70%);
}
@keyframes ocean-neb { to { transform: translateX(-18px) scale(1.06); } }

/* stars, shooting stars, constellation (only visible at evening and night) */
.ocean-stars {
  inset: 0 0 28% 0; z-index: 0;
  opacity: var(--ostar);
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}
.ocean-stars i {
  position: absolute; border-radius: 50%; background: #fff;
  opacity: var(--o);
  animation: ocean-tw var(--d) ease-in-out var(--dl) infinite alternate;
}
.ocean-stars i.big { box-shadow: 0 0 7px 1px rgba(255,255,255,.8); }
@keyframes ocean-tw {
  from { opacity: calc(var(--o) * .25); transform: scale(.75); }
  to   { opacity: var(--o); transform: scale(1.2); }
}
.ocean-stars b {
  position: absolute; width: 90px; height: 1.5px;
  background: linear-gradient(90deg, #fff, transparent);
  opacity: 0; transform-origin: left center;
  animation: ocean-shoot var(--sd) linear var(--sl) infinite;
}
@keyframes ocean-shoot {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-26deg); }
  2%   { opacity: 1; }
  9%   { opacity: 0; transform: translate(-190px, 100px) rotate(-26deg); }
  100% { opacity: 0; transform: translate(-190px, 100px) rotate(-26deg); }
}
.ocean-const { z-index: 0; left: 50%; top: 22%; width: 150px; height: 84px; opacity: calc(var(--ostar) * .85); }
.ocean-const polyline { fill: none; stroke: rgba(255,255,255,.32); stroke-width: 1; stroke-dasharray: 3 3; }
.ocean-const circle { fill: #fff; }

.ocean-rays {
  inset: 0; z-index: 1;
  opacity: calc((1 - var(--ostar)) * .22);
  mix-blend-mode: screen;
  background: conic-gradient(from 200deg at var(--osx) var(--osy),
    transparent 0 8deg, rgba(255,255,255,.55) 12deg, transparent 18deg 30deg,
    rgba(255,255,255,.4) 34deg, transparent 40deg 56deg,
    rgba(255,255,255,.45) 60deg, transparent 66deg 360deg);
  -webkit-mask-image: radial-gradient(circle at var(--osx) var(--osy), #000, transparent 70%);
  mask-image: radial-gradient(circle at var(--osx) var(--osy), #000, transparent 70%);
}
.ocean-bg[data-orb='moon'] .ocean-rays { display: none; }

.ocean-birds {
  z-index: 1; top: 14%; left: -12%; width: 90px; height: 30px;
  opacity: calc((1 - var(--ostar)) * .75);
  animation: ocean-fly 38s linear infinite;
}
.ocean-birds path { fill: none; stroke: rgba(255,255,255,.9); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes ocean-fly { to { transform: translate(1150px, -18px); } }

/* clouds */
.ocean-cloud {
  height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.95);
  filter: blur(9px);
  opacity: var(--ocloud);
  animation: ocean-drift linear infinite;
}
.ocean-cloud::after {
  content: ""; position: absolute; left: 22%; top: -70%;
  width: 46%; height: 150%; border-radius: 50%; background: inherit;
}
.oc1 { z-index: 1; width: 130px; top: 24%; left: -20%; animation-duration: 110s; }
.oc2 { z-index: 1; width: 90px;  top: 66%; left: -20%; animation-duration: 150s; animation-delay: -70s; }
.oc3 { z-index: 2; width: 190px; height: 14px; top: 50%; left: -24%; animation-duration: 125s; animation-delay: -35s; opacity: calc(var(--ocloud) * .8); }
@keyframes ocean-drift { to { transform: translateX(1700px); } }

/* sun and moon */
.ocean-orb {
  z-index: 2;
  left: var(--osx); top: var(--osy);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .7s;
}
.ocean-sun {
  width: 58px; height: 58px;
  background: radial-gradient(circle at 40% 35%, #fff, var(--oorb) 72%);
  box-shadow: 0 0 0 10px rgba(255,255,255,.12), 0 0 54px 20px var(--oglow);
}
.ocean-moon {
  width: 50px; height: 50px;
  background: radial-gradient(circle at 35% 30%, #fff, #dcecff 55%, #b9d2ea);
  box-shadow: 0 0 0 13px rgba(190,220,255,.07), 0 0 0 30px rgba(190,220,255,.04), 0 0 40px 10px var(--oglow);
}
.ocean-moon::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 62% 38%, rgba(120,150,180,.35) 0 7px, transparent 8px),
    radial-gradient(circle at 40% 66%, rgba(120,150,180,.3) 0 5px, transparent 6px),
    radial-gradient(circle at 72% 72%, rgba(120,150,180,.25) 0 4px, transparent 5px);
}
.ocean-bg[data-orb='sun'] .ocean-sun,
.ocean-bg[data-orb='moon'] .ocean-moon { opacity: 1; }

/* horizon glow and waves */
.ocean-hz {
  z-index: 3; left: 0; right: 0; bottom: 0; height: 70%; opacity: .3;
  background: linear-gradient(0deg, var(--oglow), transparent);
  mix-blend-mode: screen;
}
.ocean-scene { z-index: 3; left: 0; right: 0; bottom: 0; width: 100%; height: 64%; }
.ocean-scene .o-a { fill: var(--o1); }
.ocean-scene .o-b { fill: var(--o2); }
.ocean-scene .o-c { fill: var(--o3); }
.ocean-wave { animation: ocean-wave linear infinite; }
@keyframes ocean-wave { to { transform: translateX(-245px); } }
.ocean-boat { transform-box: fill-box; transform-origin: 50% 100%; animation: ocean-bob 4s ease-in-out infinite; }
@keyframes ocean-bob { 50% { transform: translateY(-2px) rotate(2deg); } }

/* finishing layers */
.ocean-grain {
  inset: 0; z-index: 3; opacity: .1; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ocean-scrim {
  inset: 0; z-index: 3;
  background:
    linear-gradient(90deg, rgba(0,18,24,.36), rgba(0,18,24,.1) 55%, transparent),
    linear-gradient(180deg, transparent 55%, rgba(0,0,0,.16));
}

@media (max-width: 600px) {
  .ocean-const { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ocean-bg *, .ocean-bg { animation: none !important; transition-duration: .01ms !important; }
}


:root {
  --sb-g1: #01aba8;
  --sb-g2: #00705f;
  --sb-g3: #003c32;
  --sb-g4: #001a17;
  --sb-panel: #ffffff;
  --sb-ink: #072144;
  --sb-accent: #01aba8;
  --sb-pill: rgba(255, 255, 255, 0.09);
  --sb-r: 30px;
  --sb-ih: 44px;
  --sb-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --sb-slide: cubic-bezier(0.22, 1, 0.36, 1);
  --sb-dur: 0.65s;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) {
  z-index: 2;
  clip-path: circle(0px at var(--sb-x, 0px) var(--sb-y, 50%));
}

/* while a page-reveal transition runs, close the drawer instantly instead of sliding it */
[data-sb-instant] .sb-drawer,
[data-sb-instant] .sb-backdrop,
[data-sb-instant] .sb-trigger {
  transition: none !important;
}

/* ---------- edge tab: current-section peek ---------- */
.sb-trigger {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 38px;
  min-height: 88px;
  padding: 12px 0;
  color: #fff;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-left: 0;
  border-radius: 0 20px 20px 0;
  background: linear-gradient(180deg, var(--sb-g1), var(--sb-g3));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(-50%);
  transition: transform 0.4s var(--sb-ease), opacity 0.25s ease, width 0.25s var(--sb-ease);
}
.sb-trigger:hover { width: 46px; }
.sb-trigger:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 2px; }
.sb-trigger-hide { transform: translate(-100%, -50%); opacity: 0; pointer-events: none; }
.sb-trigger svg { flex: none; }

.sb-trigger-label {
  writing-mode: vertical-rl;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1em;
  white-space: nowrap;
  max-height: 150px;           /* very long names end in an ellipsis */
  overflow: hidden;
  text-overflow: ellipsis;
  animation: sb-peek-in 0.35s var(--sb-ease);
}
@keyframes sb-peek-in {
  from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .sb-trigger-label { animation: none; }
}

/* ---------- backdrop ---------- */
.sb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.sb-backdrop.sb-open { opacity: 1; visibility: visible; transition: opacity 0.4s ease, visibility 0s; }

/* ---------- drawer ---------- */
.sb-drawer {
  position: fixed;
  top: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 1001;
  display: flex;
  width: min(470px, calc(100vw - 20px));
  border-radius: 40px;
  overflow: hidden;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, var(--sb-g1) 0%, var(--sb-g2) 35%, var(--sb-g3) 75%, var(--sb-g4) 100%);
  transform: translateX(calc(-100% - 20px));
  visibility: hidden;
  transition: transform 0.5s var(--sb-slide), visibility 0s linear 0.5s;
}
.sb-drawer.sb-open { transform: none; visibility: visible; transition: transform 0.5s var(--sb-slide), visibility 0s; }
.sb-drawer *, .sb-drawer *::before, .sb-drawer *::after { box-sizing: border-box; }

.sb-stars {
  position: absolute; top: 0; left: 0; width: 240px; height: 160px; pointer-events: none;
  background:
    radial-gradient(1.2px 1.2px at 30px 24px, #fff8, transparent),
    radial-gradient(1px 1px at 120px 40px, #fff7, transparent),
    radial-gradient(1.2px 1.2px at 170px 14px, #fff9, transparent),
    radial-gradient(1px 1px at 90px 100px, #fff5, transparent),
    radial-gradient(1px 1px at 210px 90px, #fff6, transparent);
}

/* ---------- left rail ---------- */
.sb-rail { width: 196px; flex: none; display: flex; flex-direction: column; padding: 14px 0 14px 14px; position: relative; z-index: 1; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding-right: 18px; margin-bottom: 6px; }
.sb-logo {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.sb-logo-img { width: 40px; height: 40px; object-fit: contain; }
.sb-close {
  width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, 0.22); color: #fff; display: grid; place-items: center;
  cursor: pointer; transition: background 0.2s;
}
.sb-close:hover { background: rgba(255, 255, 255, 0.32); }

.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.sb-scroll::-webkit-scrollbar { display: none; }
.sb-nav { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 30px 0; } /* 30px = room for the notches */

.sb-indicator {
  position: absolute; left: 0; right: 0; top: 0; height: var(--sb-ih); z-index: 1; pointer-events: none;
  background: var(--sb-panel);
  border-radius: calc(var(--sb-ih) / 2) 0 0 calc(var(--sb-ih) / 2);
  transition: transform var(--sb-dur) var(--sb-ease);
}
.sb-indicator::before, .sb-indicator::after { content: ''; position: absolute; right: 0; width: var(--sb-r); height: var(--sb-r); }
.sb-indicator::before { top: calc(var(--sb-r) * -1); background: radial-gradient(circle at 0 0, transparent var(--sb-r), var(--sb-panel) calc(var(--sb-r) + 0.5px)); }
.sb-indicator::after { bottom: calc(var(--sb-r) * -1); background: radial-gradient(circle at 0 100%, transparent var(--sb-r), var(--sb-panel) calc(var(--sb-r) + 0.5px)); }

.sb-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: var(--sb-ih);
  padding: 0 14px 0 16px; border: 0; cursor: pointer; text-align: left; color: #fff;
  background: var(--sb-pill);
  font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.15;
  border-radius: calc(var(--sb-ih) / 2) 0 0 calc(var(--sb-ih) / 2);
  transition: background 0.25s ease, color 0.35s var(--sb-ease);
}
.sb-item:hover { background: rgba(255, 255, 255, 0.16); }
.sb-item:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sb-item > * { position: relative; z-index: 2; }
.sb-item-icon { display: inline-flex; flex: none; }
.sb-item-active, .sb-item-active:hover { color: var(--sb-ink); background: transparent; }

/* ---------- white panel ---------- */
.sb-panel {
  flex: 1; min-width: 0; margin-left: -1px; position: relative; z-index: 0; overflow-y: auto;
  background: var(--sb-panel); border-radius: var(--sb-r) 0 0 var(--sb-r);
  padding: 22px 14px 22px 24px; font-family: inherit;
}
.sb-panel-inner { animation: sb-in 0.35s var(--sb-ease); }
@keyframes sb-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.sb-panel h2 { margin: 4px 0 14px; font-size: 19px; font-weight: 800; line-height: 1.2; color: var(--sb-ink); }
.sb-panel ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sb-link {
  display: block; padding: 11px 14px; border-radius: 14px; text-decoration: none;
  font-size: 14.5px; font-weight: 600; color: #14221c; transition: background 0.2s, color 0.2s;
}
.sb-link:hover { background: var(--accent-light); }
.sb-link:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 2px; }
.sb-link-active, .sb-link-active:hover { background: var(--sb-accent); color: #fff; }

.sb-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-panel-head h2 { margin: 4px 0 14px; }
.sb-back {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--sb-accent);
  background: var(--accent-light);
  transition: background 0.2s ease, color 0.2s ease;
}
.sb-back:hover { background: var(--sb-accent); color: #fff; }
.sb-back:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 2px; }
.sb-back svg { display: block; }

@media (max-width: 900px) {
  .sb-drawer { width: min(430px, calc(100vw - 20px)); }
  .sb-rail { width: 180px; }
}

/* Phones: the drawer becomes a full-screen sheet with a single pane at a time. */
@media (max-width: 640px) {
  .sb-drawer {
    top: max(8px, env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    right: 8px;
    width: auto;
    flex-direction: column;
    border-radius: 26px;
  }
  .sb-drawer[data-pane="groups"] .sb-panel,
  .sb-drawer[data-pane="children"] .sb-rail { display: none; }
  .sb-drawer[data-pane="groups"] .sb-rail,
  .sb-drawer[data-pane="children"] .sb-panel { flex: 1 1 auto; min-height: 0; }

  .sb-rail {
    width: auto;
    padding: max(12px, env(safe-area-inset-left)) 12px 8px;
  }
  .sb-top { padding-right: 16px; }
  .sb-logo { width: 42px; height: 42px; }
  .sb-logo-img { width: 34px; height: 34px; }

  /* Taller touch targets in the rail. */
  .sb-drawer { --sb-ih: 48px; }
  .sb-item { font-size: 14.5px; }
  .sb-nav { gap: 8px; }

  .sb-panel {
    margin-left: 0;
    border-radius: 0;
    padding: 18px 14px 20px;
  }
  .sb-link { padding: 13px 14px; font-size: 15px; }
  .sb-panel h2 { font-size: 18px; margin: 0 0 14px; }
  .sb-panel-head h2 { margin: 0; }
}

@media (max-width: 360px) {
  .sb-drawer { border-radius: 20px; }
  .sb-item { gap: 9px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-drawer, .sb-backdrop, .sb-trigger, .sb-indicator, .sb-panel-inner { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
