:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --primary: #2f6fed;
  --primary-dark: #2252b8;
  --text: #1b1f2a;
  --muted: #6b7280;
  --border: #e4e7ee;
  --success: #1f9d55;
  --warning: #ffb020;
  --danger: #e5484d;
  --sidebar: #0f172a;
  --sidebar-muted: #94a3b8;
}

* {
  box-sizing: border-box;
}

html {
  zoom: 80%;
}

body {
  margin: 0;
  font-family: "Cairo", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.24s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111c35 100%);
  color: #fff;
  border-left: 1px solid rgba(148, 163, 184, 0.16);
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
}

.brand-subtitle {
  color: var(--sidebar-muted);
  font-size: 12px;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  color: var(--sidebar-muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 14px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-link-active {
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.28), rgba(56, 189, 248, 0.2));
  border-color: rgba(96, 165, 250, 0.35);
  color: #fff;
}

.nav-link-primary {
  color: #ffffff;
  border-color: rgba(96, 165, 250, 0.35);
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.24), rgba(56, 189, 248, 0.2));
}

.nav-empty {
  color: var(--sidebar-muted);
  font-size: 13px;
  line-height: 1.7;
  padding: 8px 4px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar-row,
.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-row {
  width: 100%;
}

.topbar-main {
  width: 100%;
  flex-wrap: wrap;
}

.topbar-brand .brand-title {
  font-size: 16px;
}

.topbar-title {
  font-weight: 700;
  font-size: 17px;
}

.topbar-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-nav {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

.top-home-link,
.module-menu-trigger,
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-home-link:hover,
.module-menu-trigger:hover,
.sidebar-toggle:hover {
  border-color: rgba(47, 111, 237, 0.35);
  box-shadow: 0 10px 24px rgba(47, 111, 237, 0.08);
}

.top-home-link-active,
.module-menu-trigger-active {
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.1), rgba(56, 189, 248, 0.12));
  border-color: rgba(47, 111, 237, 0.28);
  color: var(--primary-dark);
}

.module-menu {
  position: relative;
}

.module-menu-caret {
  font-size: 12px;
  color: var(--muted);
}

.module-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 260px;
  max-width: min(360px, 80vw);
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  display: none;
}

.module-menu-open .module-menu-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-menu-link {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}

.module-menu-link:hover {
  background: #f3f7ff;
  color: var(--primary-dark);
}

.module-menu-link-primary {
  background: #eef4ff;
  color: var(--primary-dark);
  font-weight: 700;
}

.module-menu-link-active {
  background: #edf6ff;
  color: var(--primary-dark);
  font-weight: 700;
}

.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.sidebar-toggle {
  display: inline-flex;
}

.content {
  padding: 16px;
}

.home-shell {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.95fr);
  gap: 24px;
  padding: 32px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.24), transparent 30%),
    radial-gradient(circle at bottom left, rgba(47, 111, 237, 0.16), transparent 35%),
    linear-gradient(135deg, #ffffff 0%, #f3f8ff 48%, #eef3fb 100%);
  border: 1px solid rgba(47, 111, 237, 0.12);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(47, 111, 237, 0.1);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.home-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.home-lead {
  max-width: 720px;
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.9;
  color: #4b5563;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.home-hero-panel {
  display: grid;
  gap: 14px;
}

.home-stat-card {
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.home-stat-card-accent {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.95));
  color: #fff;
}

.home-stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.home-stat-card-accent .home-stat-label,
.home-stat-card-accent .home-stat-note {
  color: rgba(226, 232, 240, 0.78);
}

.home-stat-value {
  display: block;
  margin-top: 12px;
  font-size: 28px;
  line-height: 1.3;
}

.home-stat-value-small {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.home-stat-note {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.8;
  color: #6b7280;
}

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.home-section-title {
  margin: 0;
  font-size: 24px;
}

.home-section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.home-quick-links {
  padding: 22px;
  border-radius: 24px;
}

.home-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.home-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: linear-gradient(135deg, #ffffff, #f6faff);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 111, 237, 0.28);
  box-shadow: 0 14px 28px rgba(47, 111, 237, 0.1);
}

.home-modules {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.home-module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 280px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 24px;
  background: #fff;
  text-align: right;
  cursor: pointer;
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

.home-module-card:hover {
  transform: translateY(-4px);
  border-color: rgba(47, 111, 237, 0.24);
  box-shadow: 0 24px 44px rgba(15, 23, 42, 0.1);
}

.home-module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(15, 23, 42, 0.02));
  pointer-events: none;
}

.home-module-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.home-module-badge {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.82);
}

.home-module-title {
  margin: 16px 0 8px;
  font-size: 24px;
  line-height: 1.4;
}

.home-module-copy {
  margin: 0;
  color: #475569;
  line-height: 1.9;
  flex: 1;
}

.home-module-link {
  margin-top: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.home-module-card-accounting {
  background: linear-gradient(135deg, #fff7e7, #fff);
}

.home-module-card-procurement {
  background: linear-gradient(135deg, #eefbf3, #fff);
}

.home-module-card-inventory {
  background: linear-gradient(135deg, #eef7ff, #fff);
}

.home-module-card-sales {
  background: linear-gradient(135deg, #fff0f1, #fff);
}

.home-module-card-pos {
  background: linear-gradient(135deg, #f2f2ff, #fff);
}

.home-module-card-hr {
  background: linear-gradient(135deg, #f0fdf4, #fff);
}

.home-module-card-reports {
  background: linear-gradient(135deg, #eefcfb, #fff);
}

.home-module-card-settings {
  background: linear-gradient(135deg, #f8f5ff, #fff);
}

.dashboard-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.9fr);
  gap: 22px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.07);
}

.dashboard-hero-finance {
  background: linear-gradient(135deg, #fff8ea 0%, #f6fbff 100%);
}

.dashboard-hero-reports {
  background: linear-gradient(135deg, #eef8ff 0%, #f9fffc 100%);
}

.dashboard-hero-settings {
  background: linear-gradient(135deg, #f8f5ff 0%, #fefefe 100%);
}

.dashboard-hero-pos {
  background: linear-gradient(135deg, #eff4ff 0%, #f5f9ff 100%);
}

.dashboard-hero-hr {
  background: linear-gradient(135deg, #f0fdf4 0%, #f7fefb 100%);
}

.dashboard-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.dashboard-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.3;
}

.dashboard-lead {
  margin: 14px 0 0;
  color: #475569;
  line-height: 1.9;
  max-width: 820px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.dashboard-actions.compact {
  margin-top: 16px;
}

.dashboard-mini-stats {
  display: grid;
  gap: 12px;
}

.dashboard-mini-stat {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.dashboard-mini-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.dashboard-mini-value {
  display: block;
  margin-top: 10px;
  font-size: 22px;
  line-height: 1.4;
  color: var(--text);
}

.dashboard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.dashboard-card-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dashboard-panel-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 220px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
  text-align: right;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

button.dashboard-panel-card {
  cursor: pointer;
}

.dashboard-panel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(47, 111, 237, 0.22);
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.08);
}

.dashboard-panel-card-soft {
  background: linear-gradient(135deg, #ffffff, #f8fbff);
}

.dashboard-panel-card-report {
  background: linear-gradient(135deg, #fff, #f8fbff);
}

.dashboard-panel-card-setting {
  background: linear-gradient(135deg, #fff, #fbf9ff);
}

.dashboard-panel-card-pos {
  background: linear-gradient(135deg, #fff, #f4f8ff);
}

.dashboard-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 24px;
  background: rgba(47, 111, 237, 0.08);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.08);
}

.dashboard-card-title {
  margin: 16px 0 8px;
  font-size: 22px;
  line-height: 1.4;
}

.dashboard-card-copy {
  margin: 0;
  color: #475569;
  line-height: 1.85;
  flex: 1;
}

.dashboard-bullet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  color: #475569;
}

.dashboard-bullet-list span {
  position: relative;
  padding-right: 16px;
}

.dashboard-bullet-list span::before {
  content: "";
  position: absolute;
  right: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}

.dashboard-console-card {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

.dashboard-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-console-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf6ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.reports-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pos-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.workspace-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.workspace-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.85fr);
  gap: 18px;
  padding: 24px 26px;
  border-radius: 26px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.workspace-hero-accounting {
  background: linear-gradient(135deg, #fff8eb 0%, #f8fbff 100%);
}

.workspace-hero-receipt {
  background: linear-gradient(135deg, #eefcf3 0%, #fbfffd 100%);
}

.workspace-hero-payment {
  background: linear-gradient(135deg, #fff3f3 0%, #fffdfd 100%);
}

.workspace-hero-master {
  background: linear-gradient(135deg, #f2f6ff 0%, #ffffff 100%);
}

.workspace-hero-copy {
  min-width: 0;
}

.workspace-hero-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.workspace-card {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}

.workspace-card-form {
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
}

.section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 14px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  overflow: hidden;
}

.table-card-wrap {
  padding-top: 18px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dense-table thead {
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fd 100%);
}

.dense-table th,
.dense-table td {
  padding: 12px 14px;
  border-color: rgba(228, 231, 238, 0.8);
  vertical-align: top;
}

.dense-table tbody tr:hover {
  background: rgba(47, 111, 237, 0.03);
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.toggle-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-hero-tree {
  background: linear-gradient(135deg, #f5f7ff 0%, #ffffff 100%);
}

.tree-panel {
  max-height: 72vh;
  overflow: auto;
  padding-inline-end: 4px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tree-node-idle {
  background: linear-gradient(135deg, #ffffff, #fbfcff);
}

.tree-node-idle:hover {
  background: #f7faff;
  border-color: rgba(47, 111, 237, 0.18);
}

.tree-node-active {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-color: rgba(96, 165, 250, 0.28);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
}

.tree-node-active .text-slate-500 {
  color: rgba(226, 232, 240, 0.72) !important;
}

.tree-node-toggle,
.tree-node-spacer {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.tree-node-toggle {
  border: none;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.16);
  color: inherit;
  cursor: pointer;
}

.tree-node-icon {
  font-size: 18px;
}

.tree-node-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.crumb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f3f6fb;
  color: #475569;
  font-size: 12px;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.app-modal-panel {
  width: min(100%, 760px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.22);
}

.app-modal-panel-md {
  width: min(100%, 560px);
}

.app-modal-panel-lg {
  width: min(100%, 860px);
}

.app-modal-panel-xl {
  width: min(100%, 1024px);
}

.app-modal-panel-2xl {
  width: min(100%, 1280px);
}

.journal-form-modal {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.journal-entry-form-screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.journal-items-table-wrap {
  overflow: hidden;
}

.journal-items-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

.app-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 22px;
  margin: 0 0 8px;
}

.card-subtitle {
  color: var(--muted);
  margin: 4px 0 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 14px;
}

.required-mark {
  color: #dc2626;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  background: #fff;
}

textarea {
  resize: vertical;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  /* inline-flex, not the default: `.btn` is put on <a> in ~44 places, where
     `display: inline` swallows the vertical padding and leaves the link
     underlined and misaligned next to a real <button>. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn:hover,
.btn:focus,
.btn:visited {
  text-decoration: none;
}

/* Used in ~20 places but never defined, so every "small" button rendered at
   full size — which is what makes a row of table actions overflow. */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  /* Compensates for the border so an outline button lines up with a solid one. */
  padding: 9px 17px;
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: rgba(47, 111, 237, 0.08); /* --primary at 8% */
  color: var(--primary-dark);
}

.btn-sm.btn-outline {
  padding: 5px 11px;
}

/* `.input` was referenced on nearly every form control in the app but never
   defined. Controls inside a `.field` wrapper stretched anyway; the ones in a
   plain grid cell fell back to the browser's intrinsic width, which is what
   makes a two-column form look ragged. */
.input {
  width: 100%;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill-success {
  background: rgba(31, 157, 85, 0.15);
  color: var(--success);
}

.pill-info {
  background: rgba(14, 116, 144, 0.14);
  color: #0f766e;
}

.pill-danger {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.pill-warning {
  background: rgba(255, 176, 32, 0.2);
  color: #915a00;
}

.pill-muted {
  background: #eef2f7;
  color: var(--muted);
}

.alert {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(229, 72, 77, 0.1);
  color: var(--danger);
}

.success {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 157, 85, 0.1);
  color: var(--success);
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  overflow-x: auto;
  min-height: 80px;
}

.response {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 960px) {
  html {
    zoom: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    padding: 16px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 320px);
    z-index: 60;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    box-shadow: -18px 0 40px rgba(15, 23, 42, 0.18);
  }

  .sidebar-panel {
    height: 100%;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.42);
  }

  .sidebar-close,
  .sidebar-toggle,
  .sidebar-open .sidebar-backdrop {
    display: inline-flex;
  }

  .topbar-row,
  .topbar-main {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .topbar-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .top-home-link,
  .module-menu-trigger {
    flex: 0 0 auto;
  }

  .module-menu {
    flex: 0 0 auto;
  }

  .module-menu-panel {
    position: fixed;
    top: auto;
    right: 16px;
    left: 16px;
    min-width: 0;
    max-width: none;
    max-height: min(55vh, 420px);
    margin-top: 0;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
  }

  .content {
    padding: 18px 16px 28px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .workspace-hero {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .workspace-hero-actions {
    justify-content: flex-start;
  }

  .home-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-module-grid {
    grid-template-columns: 1fr;
  }

  .home-module-card {
    min-height: 0;
  }

  .dashboard-panel-card {
    min-height: 0;
  }

  .workspace-card {
    padding: 18px;
  }

  .section-head,
  .table-toolbar,
  .app-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid-4,
  .form-grid-3,
  .form-grid-2,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .app-modal {
    padding: 12px;
  }

  .app-modal-panel {
    padding: 18px;
    max-height: calc(100vh - 24px);
  }

  .dashboard-console-head {
    flex-direction: column;
    align-items: flex-start;
  }
}


table {
  width: 100%;
  border-collapse: collapse;
}

table thead {
  background: var(--bg);
}

table th,
table td {
  padding: 12px;
  border: 1px solid var(--border);
}

table th {
  text-align: right;
}