/* ============================================================
   Notipa — Application UI
   Palette: paper white + verified green + inventory ink
   Type: Space Grotesk (bold display) + IBM Plex Sans (body) + IBM Plex Mono (data)
   Light, high-contrast, no gradients, no framework — hand-rolled.
   Signature element: the "tag" — every badge/chip carries a small
   eyelet, used across Notipa for status (read/unread, paid/unpaid,
   permission-slip response) rather than a plain coloured pill.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* =====================================================
   TOKENS
   ===================================================== */
:root {
  /* Backgrounds — lightest to raised */
  --paper:         #F5F6F1;
  --paper-sunken:  #ECEEE7;
  --surface:       #FFFFFF;
  --surface-raised:#FFFFFF;

  /* Borders */
  --line:        #DBDFD5;
  --line-strong: #12181A;
  --line-brand:  #0B6E4F;

  /* Ink */
  --ink:       #12181A;
  --ink-muted: #565F5A;
  --ink-dim:   #8A928B;
  --ink-on-brand: #F5F6F1;

  /* Brand — "verified green": the product's promise is certainty */
  --brand:       #0B6E4F;
  --brand-bright:#0E8862;
  --brand-dim:   #084F39;
  --brand-soft:  rgba(11, 110, 79, 0.09);

  /* Attention */
  --amber:      #B9770E;
  --amber-soft: rgba(185, 119, 14, 0.10);
  --brick:      #AE3B2C;
  --brick-soft: rgba(174, 59, 44, 0.10);
  --slate:      #5A6470;
  --slate-soft: rgba(90, 100, 112, 0.10);

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-data:    'IBM Plex Mono', monospace;

  /* Geometry — bold, not timid */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* Layout */
  --sidebar-width: 224px;
  --topbar-height: 60px;
}

/* =====================================================
   RESET
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-bright); }

h1, h2, h3, h4, h5 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 { font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; letter-spacing: 0; }

p { margin: 0 0 14px; color: var(--ink-muted); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

/* =====================================================
   APP SHELL
   ===================================================== */
.app-shell { display: flex; height: 100vh; }

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar__wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.sidebar__mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar__mark svg { width: 17px; height: 17px; stroke: var(--ink-on-brand); }

.sidebar__wordmark-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}
.sidebar__wordmark-text span { display: block; font-family: var(--font-data); font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }

.sidebar__section { padding: 16px 0 6px; }

.sidebar__section-label {
  padding: 0 20px 8px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.sidebar__nav-item a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 20px;
  margin: 0 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: color .15s, background .15s;
}
.sidebar__nav-item a svg { width: 17px; height: 17px; stroke: currentColor; flex-shrink: 0; }

.sidebar__nav-item a:hover { color: var(--ink); background: var(--paper-sunken); }

.sidebar__nav-item a.active {
  color: var(--brand-dim);
  background: var(--brand-soft);
  font-weight: 600;
}

.sidebar__footer {
  margin-top: auto;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-dim);
}

/* =====================================================
   MAIN AREA / TOPBAR
   ===================================================== */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
}

.topbar__breadcrumb { font-size: 13px; color: var(--ink-dim); flex: 1; }
.topbar__breadcrumb a { color: var(--ink-dim); }
.topbar__breadcrumb a:hover { color: var(--brand); }
.topbar__breadcrumb-sep { margin: 0 7px; color: var(--ink-dim); }
.topbar__breadcrumb-current { color: var(--ink); font-weight: 500; }

.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* =====================================================
   PAGE CONTENT
   ===================================================== */
.page-content { flex: 1; padding: 32px 36px 48px; overflow-y: auto; min-height: 0; }
.page-content__inner { max-width: 1180px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.page-header__eyebrow {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 6px;
  display: block;
}
.page-header h1 { margin-bottom: 4px; }
.page-header__sub { font-size: 14px; color: var(--ink-muted); margin: 0; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  line-height: 1;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dim); border-color: var(--brand-dim); }

.btn--secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn--secondary:hover { background: var(--paper-sunken); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-muted); padding-left: 8px; padding-right: 8px; }
.btn--ghost:hover { color: var(--ink); background: var(--paper-sunken); }

.btn--danger { background: var(--surface); border-color: var(--brick); color: var(--brick); }
.btn--danger:hover { background: var(--brick-soft); }

.btn--sm { font-size: 12.5px; padding: 6px 12px; }
.btn--icon { padding: 8px; }

/* =====================================================
   FORMS
   ===================================================== */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

.field__label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.field__hint { font-size: 12px; color: var(--ink-dim); margin-top: 5px; }

.input, .select, textarea.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder { color: var(--ink-dim); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  max-width: 340px;
}
.search-bar svg { width: 16px; height: 16px; stroke: var(--ink-dim); flex-shrink: 0; }
.search-bar input { border: none; outline: none; font-size: 14px; font-family: var(--font-body); flex: 1; background: transparent; color: var(--ink); }
.search-bar input::placeholder { color: var(--ink-dim); }
.search-bar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

/* =====================================================
   TAGS — the signature element
   Every tag carries a small eyelet, used here for status:
   read/unread, paid/unpaid, permission-slip yes/no/pending.
   ===================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 4px 10px 4px 7px;
  border-radius: var(--radius-sm);
  border: 1.5px solid currentColor;
  color: var(--ink-muted);
  background: var(--surface);
  white-space: nowrap;
}
.tag__eyelet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}

.tag--active   { color: var(--brand-dim); background: var(--brand-soft); }
.tag--warning  { color: var(--amber); background: var(--amber-soft); }
.tag--critical { color: var(--brick); background: var(--brick-soft); }
.tag--neutral  { color: var(--slate); background: var(--slate-soft); }

.tag--solid { color: #fff; border-color: transparent; }
.tag--solid.tag--active   { background: var(--brand); }
.tag--solid.tag--warning  { background: var(--amber); }
.tag--solid.tag--critical { background: var(--brick); }
.tag--solid.tag--neutral  { background: var(--slate); }
.tag--solid .tag__eyelet  { background: transparent; border-color: rgba(255,255,255,.7); }

/* Reference / ID chip — same family, no status colour.
   Used for e.g. student LRN or school-assigned IDs. */
.asset-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper-sunken);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px 9px 3px 6px;
}
.asset-id__eyelet { width: 6px; height: 6px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--ink-dim); flex-shrink: 0; }

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card--pad-lg { padding: 28px; }

.card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card__title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); margin: 0; }
.card__link { font-size: 12.5px; font-weight: 600; }

.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* =====================================================
   METRIC TILES — bold stat cards for the dashboard
   ===================================================== */
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }

.metric-tile {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  overflow: hidden;
}
.metric-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--ink-dim);
}
.metric-tile--brand::before  { background: var(--brand); }
.metric-tile--amber::before  { background: var(--amber); }
.metric-tile--brick::before  { background: var(--brick); }

.metric-tile__label {
  font-family: var(--font-data);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 10px;
}
.metric-tile__value { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -0.01em; }
.metric-tile__sub { font-size: 12.5px; color: var(--ink-muted); margin-top: 8px; }
.metric-tile__sub--brand { color: var(--brand-dim); font-weight: 600; }
.metric-tile__sub--amber { color: var(--amber); font-weight: 600; }

/* =====================================================
   LISTS — e.g. "Recent Announcements", "Pending Responses"
   ===================================================== */
.list-group { display: flex; flex-direction: column; }

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }

.list-row__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--paper-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-row__icon svg { width: 17px; height: 17px; stroke: var(--ink-muted); }

.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.list-row__meta { font-size: 12px; color: var(--ink-dim); }
.list-row__meta .asset-id { margin-right: 6px; }

.list-row__end { flex-shrink: 0; text-align: right; }

.empty-list { padding: 20px 0; text-align: center; color: var(--ink-dim); font-size: 13px; }

/* =====================================================
   DATA TABLE
   ===================================================== */
.table-wrap { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.data-table th {
  font-family: var(--font-data);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 13px 16px;
  text-align: left;
  background: var(--paper-sunken);
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--paper); }
.data-table td.cell--title { color: var(--ink); font-weight: 600; }
.data-table td.cell--num { font-family: var(--font-data); text-align: right; }
.data-table td.cell--actions { text-align: right; white-space: nowrap; }

/* =====================================================
   TIMELINE — e.g. permission-slip response history / audit log
   ===================================================== */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line); }

.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item__node {
  position: absolute;
  left: -26px;
  top: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand);
}
.timeline-item--neutral .timeline-item__node { border-color: var(--ink-dim); }
.timeline-item--warning .timeline-item__node { border-color: var(--amber); }

.timeline-item__date { font-family: var(--font-data); font-size: 11px; color: var(--ink-dim); margin-bottom: 3px; }
.timeline-item__title { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.timeline-item__detail { font-size: 12.5px; color: var(--ink-muted); }

/* =====================================================
   TABS
   ===================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 24px; }

.tab {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab--active { color: var(--brand-dim); border-bottom-color: var(--brand); }

/* =====================================================
   ALERTS / BANNERS
   ===================================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  font-size: 13.5px;
  margin-bottom: 20px;
}
.alert svg { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; margin-top: 1px; }
.alert__title { font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.alert__body { color: var(--ink-muted); }

.alert--warning { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.alert--critical { background: var(--brick-soft); border-color: var(--brick); color: var(--brick); }
.alert--brand { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dim); }

/* =====================================================
   EMPTY STATES
   ===================================================== */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state__icon {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  background: var(--paper-sunken);
  display: flex; align-items: center; justify-content: center;
}
.empty-state__icon svg { width: 22px; height: 22px; stroke: var(--ink-dim); }
.empty-state__title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.empty-state__message { font-size: 13.5px; color: var(--ink-muted); margin-bottom: 20px; max-width: 340px; margin-left: auto; margin-right: auto; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(18, 24, 26, 0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
}
.modal__header { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal__title { font-family: var(--font-display); font-size: 16px; font-weight: 700; flex: 1; margin: 0; }
.modal__close { background: none; border: none; color: var(--ink-dim); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: var(--radius-sm); }
.modal__close:hover { color: var(--ink); background: var(--paper-sunken); }
.modal__body { padding: 22px 24px; }
.modal__footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1.5px solid var(--line); font-size: 12.5px; color: var(--ink-dim); }
.pagination__pages { display: flex; gap: 4px; }
.pagination__pages a, .pagination__pages span {
  min-width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-data); font-weight: 500;
  color: var(--ink-muted);
}
.pagination__pages a:hover { background: var(--paper-sunken); color: var(--ink); }
.pagination__pages .active { background: var(--brand); color: #fff; }

/* =====================================================
   UTILITY
   ===================================================== */
.text-brand  { color: var(--brand-dim); }
.text-muted  { color: var(--ink-muted); }
.text-dim    { color: var(--ink-dim); }
.text-amber  { color: var(--amber); }
.text-brick  { color: var(--brick); }
.mono        { font-family: var(--font-data); }
.divider     { height: 1px; background: var(--line); border: none; margin: 20px 0; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =====================================================
   ACCESSIBILITY
   ===================================================== */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .card-grid, .card-grid--3 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sidebar { display: none; }
  .page-content { padding: 22px 18px 40px; }
  .metric-row { grid-template-columns: 1fr; }
}
