/* ============================================================
   HR Reminder System — design system
   Inspired by soft pastel category UIs (Dribbble-style).
   ============================================================ */

:root {
  --bg:           #F0F4F8;
  --card:         #FFFFFF;
  --text:         #1F2937;
  --text-muted:   #6B7280;
  --text-soft:    #9AA4B2;
  --border:       #E5EAF0;
  --border-soft:  #EEF2F6;

  --primary:      #3F8CFF;
  --primary-50:   #E3F0FF;
  --primary-dark: #2C6BC9;

  --success:      #28C76F;
  --success-50:   #DDF7E8;
  --warning:      #FF9558;
  --warning-50:   #FFE8D6;
  --danger:       #FF5C77;
  --danger-50:    #FFE0E6;
  --info:         #7AC8FF;
  --info-50:      #DCF0FF;

  --shadow-sm:    0 2px 6px rgba(20, 30, 60, .04);
  --shadow:       0 6px 18px rgba(20, 30, 60, .06);
  --shadow-lg:    0 16px 40px rgba(20, 30, 60, .08);

  --radius:       16px;
  --radius-sm:    10px;
  --radius-pill:  999px;

  --sidebar-w:    248px;
  --topbar-h:     76px;

  /* Pastel palette for icons (bg + foreground pairs) */
  --pst-blue:    #E3F0FF; --pst-blue-fg:    #3F8CFF;
  --pst-peach:   #FFE8D6; --pst-peach-fg:   #FF9558;
  --pst-yellow:  #FFF4D1; --pst-yellow-fg:  #F5B400;
  --pst-mint:    #D6F5EE; --pst-mint-fg:    #28B8A0;
  --pst-pink:    #FFE0E6; --pst-pink-fg:    #FF6B8A;
  --pst-purple:  #ECE4FF; --pst-purple-fg:  #8B6FE8;
  --pst-red:     #FFE0E0; --pst-red-fg:     #FF5C77;
  --pst-teal:    #D6EFF5; --pst-teal-fg:    #2BA8C2;
  --pst-grey:    #EEF2F6; --pst-grey-fg:    #6B7280;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   App shell — sidebar + main
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.brand {
  padding: 24px 22px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.brand .brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #6FA8FF);
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 6px 12px rgba(63,140,255,.3);
}

.side-nav {
  display: flex;
  flex-direction: column;
  padding: 6px 14px;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.side-link:hover { background: var(--bg); color: var(--text); }
.side-link.active {
  background: var(--primary-50);
  color: var(--primary-dark);
}
.side-link .label { flex: 1; }
.side-link .count {
  background: var(--success);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  min-width: 22px;
  text-align: center;
}
.side-link .count.dim { background: var(--border); color: var(--text-muted); }

.side-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 16px 12px 6px;
}

.side-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   Pastel icon "pills" (used in sidebar + lists)
   ============================================================ */
.icon-pill {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.icon-pill-sm { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
.icon-pill-lg { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }

.icon-pill-blue   { background: var(--pst-blue);   color: var(--pst-blue-fg); }
.icon-pill-peach  { background: var(--pst-peach);  color: var(--pst-peach-fg); }
.icon-pill-yellow { background: var(--pst-yellow); color: var(--pst-yellow-fg); }
.icon-pill-mint   { background: var(--pst-mint);   color: var(--pst-mint-fg); }
.icon-pill-pink   { background: var(--pst-pink);   color: var(--pst-pink-fg); }
.icon-pill-purple { background: var(--pst-purple); color: var(--pst-purple-fg); }
.icon-pill-red    { background: var(--pst-red);    color: var(--pst-red-fg); }
.icon-pill-teal   { background: var(--pst-teal);   color: var(--pst-teal-fg); }
.icon-pill-grey   { background: var(--pst-grey);   color: var(--pst-grey-fg); }

/* ============================================================
   Main column
   ============================================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .greeting { flex: 1; }
.topbar .greeting h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .greeting p  { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }

.topbar .search {
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 9px 14px 9px 38px;
  width: 280px;
  font-size: 13px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%239AA4B2' viewBox='0 0 16 16'><path d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/></svg>");
  background-repeat: no-repeat;
  background-position: 14px center;
  outline: none;
  transition: border .15s;
}
.topbar .search:focus { border-color: var(--primary); background-color: #fff; }

.topbar .user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px;
  background: var(--bg);
  border-radius: var(--radius-pill);
}
.topbar .user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6FA8FF);
  color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.topbar .user-chip .name { font-weight: 600; font-size: 13px; }
.topbar .user-chip .role { font-size: 11px; color: var(--text-muted); }

.page {
  padding: 28px;
  flex: 1;
}

/* Page header */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.page-head h2 {
  font-size: 22px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 12px;
}
.page-head h2 .count-pill {
  font-size: 12px; font-weight: 600;
  background: var(--primary-50); color: var(--primary-dark);
  padding: 3px 10px; border-radius: var(--radius-pill);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-soft);
  padding: 16px 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card .card-body { padding: 20px; }

/* KPI cards (dashboard) */
.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* When a KPI card is wrapped in a link */
.kpi-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
  position: relative;
  transition: transform .15s, box-shadow .15s;
}
.kpi-link:hover { color: inherit; }
.kpi-link:hover .kpi-card { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-link:active .kpi-card { transform: translateY(-1px); }
.kpi-link::after {
  content: "→";
  position: absolute;
  top: 12px; right: 14px;
  color: var(--text-soft);
  opacity: 0;
  transition: opacity .15s, transform .15s;
  font-size: 14px;
}
.kpi-link:hover::after { opacity: .7; transform: translateX(2px); }

/* Clickable list rows (At a glance) */
.list-link {
  text-decoration: none; color: inherit;
  transition: background .15s;
}
.list-link:hover { background: var(--bg); color: inherit; }
.list-link::after {
  content: "›"; color: var(--text-soft); margin-left: 8px;
  opacity: 0; transition: opacity .15s, transform .15s;
}
.list-link:hover::after { opacity: 1; transform: translateX(2px); }
.kpi-card .kpi-text { flex: 1; min-width: 0; }
.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi-card .kpi-num {
  font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1;
}
.kpi-card .kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Hero greeting card (top of dashboard) */
.hello-card {
  background: linear-gradient(135deg, #3F8CFF 0%, #6FA8FF 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  box-shadow: 0 12px 28px rgba(63,140,255,.25);
  position: relative;
  overflow: hidden;
}
.hello-card::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hello-card::after {
  content: ""; position: absolute; right: 60px; bottom: -60px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hello-card .hello-text { position: relative; z-index: 1; }
.hello-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.hello-card p  { margin: 0; opacity: .9; font-size: 14px; }
.hello-card .hello-cta {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--primary-dark);
  padding: 10px 18px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 13px;
  box-shadow: 0 6px 14px rgba(0,0,0,.1);
}

/* ============================================================
   Tables — clean, with status-stripe row pattern
   ============================================================ */
.table {
  width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  background: transparent;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table-hover tbody tr:hover { background: var(--bg); }

/* Status stripe — left edge color band */
.row-stripe {
  border-left: 4px solid transparent;
}
.row-stripe.stripe-danger  { border-left-color: var(--danger); }
.row-stripe.stripe-warning { border-left-color: var(--warning); }
.row-stripe.stripe-info    { border-left-color: var(--info); }
.row-stripe.stripe-success { border-left-color: var(--success); }
.row-stripe.stripe-grey    { border-left-color: var(--border); }

/* Status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-danger  { background: var(--danger-50);  color: var(--danger); }
.pill-warning { background: var(--warning-50); color: var(--warning); }
.pill-info    { background: var(--info-50);    color: #2880D2; }
.pill-success { background: var(--success-50); color: #1A9C57; }
.pill-grey    { background: var(--pst-grey);   color: var(--pst-grey-fg); }
.pill-blue    { background: var(--pst-blue);   color: var(--pst-blue-fg); }
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .7;
}
.pill.no-dot::before { display: none; }

/* Owner cell pattern */
.owner-cell { display: flex; align-items: center; gap: 10px; }
.owner-cell .meta { display: flex; flex-direction: column; line-height: 1.2; }
.owner-cell .meta .name { font-weight: 600; }
.owner-cell .meta .sub  { font-size: 11px; color: var(--text-muted); }
.owner-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--pst-grey);
  color: var(--pst-grey-fg);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

.btn-primary  { background: var(--primary); color: #fff; box-shadow: 0 6px 14px rgba(63,140,255,.25); }
.btn-primary:hover  { background: var(--primary-dark); color: #fff; }
.btn-success  { background: var(--success); color: #fff; box-shadow: 0 6px 14px rgba(40,199,111,.25); }
.btn-success:hover  { background: #1FA85C; color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-light    { background: var(--bg); color: var(--text); }
.btn-light:hover { background: var(--border); color: var(--text); }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-outline  { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-icon     { padding: 6px 8px; min-width: 32px; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .03em;
}
.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(63,140,255,.12);
}
.form-control-sm, .form-select-sm { padding: 7px 10px; font-size: 12px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-check-label { font-size: 13px; cursor: pointer; }

.input-group { display: flex; }
.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ============================================================
   Alerts / flash
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.alert-success { background: var(--success-50); color: #1A9C57; }
.alert-danger  { background: var(--danger-50);  color: var(--danger); }
.alert-info    { background: var(--info-50);    color: #2880D2; }
.alert .btn-close {
  background: transparent; border: 0; color: inherit; opacity: .6;
  cursor: pointer; font-size: 18px;
}
.alert .btn-close:hover { opacity: 1; }

/* ============================================================
   Bootstrap-grid compat shim — so existing markup in edit/view
   pages (.row .col-md-* .g-* .p-*) keeps working.
   ============================================================ */
.row {
  display: flex; flex-wrap: wrap;
  margin-left: -8px; margin-right: -8px;
}
.row > [class*="col-"] { padding: 0 8px; min-width: 0; }
.col, .col-12 { flex: 0 0 100%; max-width: 100%; }
.col-2  { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3  { flex: 0 0 25%;     max-width: 25%; }
.col-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-5  { flex: 0 0 41.666%; max-width: 41.666%; }
.col-6  { flex: 0 0 50%;     max-width: 50%; }
.col-7  { flex: 0 0 58.333%; max-width: 58.333%; }
.col-8  { flex: 0 0 66.666%; max-width: 66.666%; }
.col-9  { flex: 0 0 75%;     max-width: 75%; }
.col-md-2  { flex: 0 0 16.666%; max-width: 16.666%; }
.col-md-3  { flex: 0 0 25%;     max-width: 25%; }
.col-md-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-5  { flex: 0 0 41.666%; max-width: 41.666%; }
.col-md-6  { flex: 0 0 50%;     max-width: 50%; }
.col-md-7  { flex: 0 0 58.333%; max-width: 58.333%; }
.col-md-8  { flex: 0 0 66.666%; max-width: 66.666%; }
.col-md-9  { flex: 0 0 75%;     max-width: 75%; }
.col-lg-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-lg-8  { flex: 0 0 66.666%; max-width: 66.666%; }

/* Bootstrap "g-N" gutter — just adds vertical gap; horizontal already handled */
.row.g-2 > [class*="col-"] { padding-bottom: 8px; padding-top: 0; }
.row.g-3 > [class*="col-"] { padding-bottom: 16px; padding-top: 0; }
.row.g-3 { margin-bottom: -16px; }
.row.g-2 { margin-bottom: -8px; }

/* Padding / margin utilities */
.p-3 { padding: 16px; } .p-4 { padding: 24px; }
.px-3 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 16px; padding-bottom: 16px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }
.m-0 { margin: 0; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.ms-2 { margin-left: 8px; }
.me-2 { margin-right: 8px; } .me-3 { margin-right: 12px; }
.mt-2 { margin-top: 8px; }

/* Background & text utilities */
.bg-success { background: var(--success-50) !important; color: #1A9C57; }
.bg-danger  { background: var(--danger-50)  !important; color: var(--danger); }
.bg-warning { background: var(--warning-50) !important; color: var(--warning); }
.bg-info    { background: var(--info-50)    !important; color: #2880D2; }
.bg-secondary { background: var(--pst-grey)   !important; color: var(--pst-grey-fg); }
.bg-primary { background: var(--primary-50) !important; color: var(--primary-dark); }
.bg-light   { background: var(--bg) !important; color: var(--text); }

.text-uppercase { text-transform: uppercase; letter-spacing: .04em; }
.text-end { text-align: right; }
.fw-bold, strong, b { font-weight: 700; }
.fw-semibold { font-weight: 600; }

/* List group */
.list-group-flush { background: transparent; }
.list-group-flush .list-group-item { background: transparent; padding: 12px 16px; }

/* Definition list grid (used in *_view pages) */
dl.row { margin: 0; }
dl.row dt, dl.row dd { padding: 6px 8px; margin: 0; min-width: 0; }
dl.row dt { color: var(--text-muted); font-weight: 600; font-size: 12px; }
dl.row dd { font-size: 13px; word-break: break-word; }

/* Images */
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: var(--radius); }

/* Card-footer */
.card-footer {
  padding: 14px 20px;
  background: transparent;
  border-top: 1px solid var(--border-soft);
}
.card-footer.text-end { text-align: right; }

/* Form check inline (Bootstrap calls it form-check d-flex etc.) */
.form-check.gap-3 { gap: 12px; }
input.form-check-input[type=checkbox] { cursor: pointer; }

/* Action-button row in edit/view pages should wrap on narrow screens */
.d-flex { display: flex; }
.d-flex.gap-2 { gap: 8px; flex-wrap: wrap; }
.flex-wrap { flex-wrap: wrap; }

/* MOBILE: collapse all col-md-* to full width on phones */
@media (max-width: 700px) {
  .col-md-2, .col-md-3, .col-md-4, .col-md-5,
  .col-md-6, .col-md-7, .col-md-8, .col-md-9,
  .col-lg-4, .col-lg-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* dl.row dt/dd stay side-by-side but more compact */
  dl.row dt { font-size: 11px; }
  dl.row dd { font-size: 12px; }
  /* Page header action rows collapse to full-width buttons */
  .d-flex.justify-content-between {
    flex-direction: column; align-items: stretch !important; gap: 10px;
  }
  .d-flex.justify-content-between > * { width: 100%; }
  .d-flex.justify-content-between .d-flex { justify-content: stretch; }
  .d-flex.justify-content-between .btn { flex: 1; justify-content: center; }
  /* Card body/headers tighter */
  .card-body, .card .p-3 { padding: 14px; }
  .p-3 { padding: 14px !important; }
  .p-4 { padding: 16px !important; }
}

/* Small phones */
@media (max-width: 480px) {
  .col-2, .col-3, .col-4 { flex: 0 0 50%; max-width: 50%; }  /* 2-up where the markup says small cols */
}

/* ============================================================
   Misc bootstrap parity
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-muted);
}
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.small { font-size: 12px; }
code {
  background: var(--bg);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 16px 0; }

/* Grid helpers (lightweight, replaces full bootstrap grid where used) */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-12-8-4 { grid-template-columns: 8fr 4fr; }
@media (max-width: 1100px) {
  .grid-12-8-4 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

.mt-3 { margin-top: 16px; } .mb-3 { margin-bottom: 16px; }
.mt-4 { margin-top: 24px; } .mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.text-center { text-align: center; }
.w-100 { width: 100%; }

/* List group (for sidebar items + dashboard at-a-glance) */
.list-group { display: flex; flex-direction: column; }
.list-group-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.list-group-item:last-child { border-bottom: 0; }

/* Dropdown — keep simple, used for admin menu */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 6px; z-index: 50;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: block; padding: 8px 12px; border-radius: 6px; color: var(--text);
}
.dropdown-item:hover { background: var(--bg); color: var(--text); }

/* Login page */
.login-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #3F8CFF 0%, #6FA8FF 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 36px 32px;
  width: 100%; max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
}
.login-card h2 { margin: 0 0 6px; text-align: center; font-weight: 700; }
.login-card .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: 13px; }
.login-card .brand-mark {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #6FA8FF);
  display: grid; place-items: center;
  color: #fff; font-size: 26px;
  box-shadow: 0 12px 24px rgba(63,140,255,.4);
}

/* Empty state */
.empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
}
.empty .icon-pill { margin: 0 auto 12px; }

/* ============================================================
   Mobile / tablet — collapse sidebar to a horizontal icon strip
   ============================================================ */
@media (max-width: 900px) {
  .app { flex-direction: column; }

  /* Sidebar becomes a sticky horizontal strip at top */
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 30;
    border-right: 0; border-bottom: 1px solid var(--border-soft);
  }
  .brand { padding: 12px 16px; font-size: 15px; }
  .brand .brand-mark { width: 32px; height: 32px; font-size: 15px; }

  .side-nav {
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 4px 12px 10px; gap: 8px;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }

  /* Hide the section headers ("RECORDS", "REMINDERS"…) and footer in horizontal mode */
  .side-section, .side-foot { display: none; }

  .side-link {
    position: relative; flex-shrink: 0;
    padding: 6px; gap: 0; min-width: 44px;
    justify-content: center;
  }
  .side-link.active { background: var(--primary-50); }
  .side-link .label { display: none; }
  .side-link .icon-pill { width: 36px; height: 36px; }
  .side-link .count {
    position: absolute; top: 0; right: 0;
    min-width: 18px; padding: 0 5px;
    font-size: 10px; line-height: 16px;
    background: var(--danger);
    box-shadow: 0 0 0 2px #fff;
  }
  .side-link .count.dim { background: var(--text-soft); }

  /* Topbar stacks: greeting first row, user-chip second row */
  .topbar {
    height: auto;
    padding: 12px 16px 14px;
    flex-direction: column; align-items: stretch;
    gap: 10px;
    position: static;
  }
  .topbar .greeting { width: 100%; }
  .topbar .greeting h1 { font-size: 15px; }
  .topbar .greeting p  { font-size: 12px; line-height: 1.35; }
  .topbar .search { display: none; }
  .topbar .user-chip { align-self: flex-end; padding: 3px 12px 3px 3px; }
  .topbar .user-chip .name { font-size: 12px; }
  .topbar .user-chip .role { font-size: 10px; }

  /* Page head stacks vertically */
  .page { padding: 16px; }
  .page-head {
    flex-direction: column; align-items: stretch; gap: 12px;
    margin-bottom: 16px;
  }
  .page-head h2 { font-size: 18px; }
  .page-head .d-flex { width: 100%; }
  .page-head .btn { flex: 1; justify-content: center; padding: 10px 14px; }

  /* KPI grid: auto-fit, vertical card layout, fits 3-4 per row */
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 8px;
    gap: 8px;
  }
  .kpi-card .icon-pill-lg { width: 38px; height: 38px; font-size: 15px; border-radius: 11px; }
  .kpi-card .kpi-text { width: 100%; min-width: 0; }
  .kpi-card .kpi-label {
    font-size: 9px;
    letter-spacing: 0;
    margin: 0 0 2px;
    line-height: 1.25;
    word-break: keep-all;
  }
  .kpi-card .kpi-num { font-size: 20px; line-height: 1; }
  .kpi-card .kpi-num.money { font-size: 12px; line-height: 1.2; word-break: break-word; }

  /* Tables: scroll horizontally rather than squish */
  .card .card-header { padding: 12px 16px; font-size: 13px; }
  .table th, .table td { padding: 10px 12px; }

  /* Hello / hero card */
  .hello-card { padding: 18px 20px; }
  .hello-card h1 { font-size: 18px; }
}

/* Tables on mobile — hide non-critical columns + tighten everything */
@media (max-width: 700px) {
  .hide-sm { display: none !important; }
  .table th, .table td { padding: 10px 8px; font-size: 12px; }
  .table th { font-size: 10px; }

  .owner-cell { gap: 8px; }
  .owner-cell .icon-pill-sm { width: 26px; height: 26px; font-size: 11px; }
  .owner-cell .meta .name { font-size: 12px; line-height: 1.25; }
  .owner-cell .meta .sub  { font-size: 10px; }

  .owner-tag {
    font-size: 8px; padding: 1px 5px; letter-spacing: .04em;
    display: inline-block; margin: 0 0 3px;
  }
  .pill { font-size: 10px; padding: 3px 7px; }

  /* tables wrap inside cards rather than overflowing the screen */
  .card > div[style*="overflow-x"] { overflow-x: visible; }

  /* Action button column tighter */
  .btn-icon { padding: 4px 6px; min-width: 28px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
}

/* Phones — even tighter KPI cards */
@media (max-width: 480px) {
  .grid { gap: 10px; }
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
  .kpi-card { padding: 10px 4px; gap: 6px; }
  .kpi-card .icon-pill-lg { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; }
  .kpi-card .kpi-label { font-size: 9px; }
  .kpi-card .kpi-num { font-size: 17px; }
  .kpi-card .kpi-num.money { font-size: 11px; }
  .topbar .greeting h1 { font-size: 14px; }
  .pill { font-size: 10px; padding: 3px 8px; }
}
