/* ==========================================================================
   Base + page layout
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5rem; color: var(--heading); font-weight: var(--fw-semibold); line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4 { font-size: 15px; } h5 { font-size: 14px; } h6 { font-size: 13px; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img, svg { vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: var(--primary-soft); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Skip link */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.skip-link:focus { top: 8px; color: #fff; }

/* Shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.page-wrap { flex: 1; padding: calc(var(--header-h) + var(--nav-h) + var(--gutter)) 0 0; }
.container { width: 100%; max-width: var(--container-max); margin: 0 auto; padding: 0 var(--gutter); }
.main-content { min-height: calc(100vh - var(--header-h) - var(--nav-h) - 120px); }

/* Page title row (reference: "HORIZONTAL LAYOUT" + breadcrumb) */
.page-title-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--gutter); min-height: 24px; }
.page-title-box h4 { margin: 0; font-size: 15px; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .01em; }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-base); color: var(--text-muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--text-light); }
.breadcrumb a { color: var(--text); }
.breadcrumb .active { color: var(--text-muted); }

/* Footer */
.footer { padding: 18px 0; margin-top: var(--gutter); color: var(--text-muted); background: #f2f2f5; font-size: var(--fs-base); }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Grid helpers (12-col like reference) */
.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.row + .row, .row + .card, .card + .row { margin-top: var(--gutter); }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; } .col-6 { grid-column: span 6; } .col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.stack { display: flex; flex-direction: column; gap: var(--gutter); min-width: 0; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gutter); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* Split layouts used by calendar / documents / AI (3 references) */
.split-2 { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gutter); align-items: start; }
.split-3 { display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; gap: var(--gutter); align-items: start; }
.split-detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gutter); align-items: start; }

/* Utilities */
.d-flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; min-width: 0; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 20px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 20px; }
.ms-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.text-muted { color: var(--text-muted) !important; } .text-light { color: var(--text-light) !important; }
.text-primary { color: var(--primary) !important; } .text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; } .text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; } .text-purple { color: var(--purple) !important; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-sm { font-size: var(--fs-sm); } .text-xs { font-size: var(--fs-xs); } .text-md { font-size: var(--fs-md); }
.fw-medium { font-weight: var(--fw-medium); } .fw-semibold { font-weight: var(--fw-semibold); }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
