/* ==========================================================================
   Hagbad Manager - mobile-first stylesheet
   Designed for large touch targets, high contrast and plain language.
   ========================================================================== */

:root {
  --brand:        #0f766e;
  --brand-dark:   #0b5c55;
  --brand-light:  #e6f2f1;
  --brand-tint:   #f2f8f7;

  --ink:          #12211f;
  --ink-2:        #384b48;
  --muted:        #63736f;
  --line:         #dfe5e3;
  --line-strong:  #c6d0cd;
  --bg:           #f5f7f6;
  --card:         #ffffff;

  --green:        #157347;
  --green-bg:     #e3f5ea;
  --orange:       #a15c07;
  --orange-bg:    #fdf0dc;
  --red:          #b42318;
  --red-bg:       #fde8e6;
  --blue:         #1d4ed8;
  --blue-bg:      #e6edfd;
  --grey:         #5b6a67;
  --grey-bg:      #edf0ef;

  --radius:       14px;
  --radius-sm:    10px;
  --shadow:       0 1px 2px rgba(16,32,29,.06), 0 8px 24px rgba(16,32,29,.06);
  --shadow-lg:    0 12px 40px rgba(16,32,29,.16);
  --tap:          48px;
  --maxw:         1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  padding-bottom: 84px; /* room for the mobile bar */
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; color: var(--ink); }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 1em; }
a  { color: var(--brand-dark); }
a:hover { color: var(--brand); }

.muted    { color: var(--muted); }
.small    { font-size: .88rem; }
.tiny     { font-size: .8rem; }
.strong   { font-weight: 700; }
.center   { text-align: center; }
.right    { text-align: right; }
.nowrap   { white-space: nowrap; }
.mono     { font-variant-numeric: tabular-nums; }
.hide     { display: none !important; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

.icon { flex: none; vertical-align: -.2em; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff;
  padding: 12px 18px; z-index: 200; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid #0d9488;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ------------------------------------------------------------- app shell */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(16,32,29,.12);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; min-height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.01em;
  font-size: 1.06rem;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.brand small { display: block; font-weight: 500; font-size: .7rem; opacity: .85; letter-spacing: .04em; }
.topbar-spacer { flex: 1; }
.topbar-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 12px;
  color: #fff; text-decoration: none; border-radius: 10px;
  background: rgba(255,255,255,.12); border: 0; cursor: pointer; font: inherit;
}
.topbar-btn:hover { background: rgba(255,255,255,.22); color: #fff; }
.topbar-user { font-size: .85rem; opacity: .95; display: none; }
.count-pip {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px;
  background: #f97316; color: #fff; border-radius: 999px;
  font-size: .68rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px;
}

.layout { max-width: var(--maxw); margin: 0 auto; display: block; padding: 0 16px; }

.sidenav { display: none; }

main { padding: 18px 0 40px; min-width: 0; }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .lede { color: var(--muted); margin: 0; font-size: .98rem; }
.page-head-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin-bottom: 8px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }

/* ------------------------------------------------------------- mobile bar */

.mobilebar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 14px rgba(16,32,29,.07);
}
.mobilebar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; min-height: var(--tap);
  color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 600;
  border-radius: 10px; position: relative;
}
.mobilebar a.active { color: var(--brand); background: var(--brand-tint); }
.mobilebar a .count-pip { top: 2px; right: 50%; margin-right: -22px; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card.tight { padding: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 18px; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--brand-tint); }

.grid { display: grid; gap: 14px; }
.grid.two   { grid-template-columns: 1fr; }
.grid.three { grid-template-columns: 1fr; }
.grid.four  { grid-template-columns: repeat(2, minmax(0,1fr)); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--tap); padding: 12px 20px;
  font: inherit; font-weight: 700; font-size: 1rem;
  border-radius: 12px; border: 2px solid transparent; cursor: pointer;
  text-decoration: none; text-align: center; transition: background .12s, box-shadow .12s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand-dark); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--brand-tint); color: var(--brand-dark); }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c6c2; }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-ghost { background: transparent; color: var(--brand-dark); padding: 10px 12px; }
.btn-ghost:hover { background: var(--brand-tint); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn-lg { min-height: 58px; font-size: 1.08rem; padding: 14px 26px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row.stack { flex-direction: column; }

.actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.action-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border-radius: var(--radius-sm); border: 2px solid var(--line);
  background: #fff; text-decoration: none; color: var(--ink); font-weight: 700; min-height: 92px;
  cursor: pointer; font-family: inherit; font-size: 1rem; text-align: left;
}
.action-tile:hover { border-color: var(--brand); background: var(--brand-tint); color: var(--ink); }
.action-tile .icon { color: var(--brand); }
.action-tile span.sub { font-weight: 500; font-size: .82rem; color: var(--muted); }

/* --------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap; line-height: 1.4;
}
.badge.green  { background: var(--green-bg);  color: var(--green); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.red    { background: var(--red-bg);    color: var(--red); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue); }
.badge.grey   { background: var(--grey-bg);   color: var(--grey); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 6px; }
.dot.green { background: var(--green); } .dot.orange { background: var(--orange); }
.dot.red { background: var(--red); } .dot.blue { background: var(--blue); } .dot.grey { background: var(--grey); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; background: var(--brand-light); color: var(--brand-dark);
  font-size: .82rem; font-weight: 700;
}

/* --------------------------------------------------------------- stats */

.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub   { font-size: .84rem; color: var(--muted); }
.stat.green  { border-left: 5px solid var(--green); }
.stat.orange { border-left: 5px solid var(--orange); }
.stat.red    { border-left: 5px solid var(--red); }
.stat.blue   { border-left: 5px solid var(--blue); }
.stat.grey   { border-left: 5px solid var(--grey); }

.progress { height: 12px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.green > span { background: var(--green); }
.progress.orange > span { background: #d97706; }

.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }

/* ---------------------------------------------------------------- forms */

.field { margin-bottom: 18px; }
.field > label, .label {
  display: block; font-weight: 700; margin-bottom: 6px; font-size: .95rem; color: var(--ink-2);
}
.field .hint { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 14px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 2px solid var(--line-strong); border-radius: 11px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2363736f' stroke-width='2'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
input[aria-invalid="true"], .field.error input, .field.error select { border-color: var(--red); background: #fffafa; }
.field .error-text { color: var(--red); font-size: .87rem; font-weight: 600; margin-top: 6px; }

.input-prefix { position: relative; }
.input-prefix span.prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 700; pointer-events: none;
}
.input-prefix input { padding-left: 34px; }

.check {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 11px; background: #fff;
  cursor: pointer; margin-bottom: 10px; min-height: var(--tap);
}
.check:hover { border-color: var(--brand); background: var(--brand-tint); }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.check .check-body { flex: 1; min-width: 0; }
.check .check-body strong { display: block; }
.check input:checked ~ .check-body strong { color: var(--brand-dark); }
.check.selected { border-color: var(--brand); background: var(--brand-tint); }

.radio-cards { display: grid; gap: 10px; }
.radio-cards label {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; min-height: var(--tap);
}
.radio-cards input { width: 22px; height: 22px; accent-color: var(--brand); }
.radio-cards label:hover { border-color: var(--brand); }
.radio-cards label.selected { border-color: var(--brand); background: var(--brand-tint); }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 800; padding: 0; margin-bottom: 10px; font-size: 1.05rem; }

.filters {
  display: grid; gap: 10px; grid-template-columns: 1fr;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px;
}
.filters .field { margin: 0; }
.filters label { font-size: .82rem; }

/* --------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 640px;
}
table.data th, table.data td { padding: 12px 14px; text-align: left; vertical-align: middle; }
table.data thead th {
  background: var(--brand-tint); color: var(--ink-2); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--line);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
table.data thead th.sortable-col { cursor: pointer; user-select: none; padding-right: 26px; position: sticky; }
table.data thead th.sortable-col::after {
  content: '⇅'; position: absolute; right: 8px; opacity: .35; font-size: .9em;
}
table.data thead th.sortable-col:hover { background: var(--brand-light); }
table.data thead th[aria-sort="ascending"]::after  { content: '↑'; opacity: 1; color: var(--brand); }
table.data thead th[aria-sort="descending"]::after { content: '↓'; opacity: 1; color: var(--brand); }
table.data tbody tr { border-bottom: 1px solid var(--line); }
table.data tbody tr:hover { background: var(--brand-tint); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot td { font-weight: 800; background: var(--brand-tint); border-top: 2px solid var(--line-strong); }
table.data .who { font-weight: 700; }
table.data a { font-weight: 600; }

.row-green  { box-shadow: inset 4px 0 0 var(--green); }
.row-orange { box-shadow: inset 4px 0 0 var(--orange); }
.row-red    { box-shadow: inset 4px 0 0 var(--red); }
.row-blue   { box-shadow: inset 4px 0 0 var(--blue); }
.row-grey   { box-shadow: inset 4px 0 0 var(--line-strong); }

/* Card-style rows used on narrow screens */
.record-list { display: grid; gap: 10px; }
.record {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; display: grid; gap: 8px;
}
.record.green  { border-left: 5px solid var(--green); }
.record.orange { border-left: 5px solid var(--orange); }
.record.red    { border-left: 5px solid var(--red); }
.record.blue   { border-left: 5px solid var(--blue); }
.record.grey   { border-left: 5px solid var(--line-strong); }
.record-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.record-top .name { font-weight: 800; }
.record dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
.record dt { color: var(--muted); }
.record dd { margin: 0; font-weight: 600; text-align: right; }

/* -------------------------------------------------------------- notices */

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  border: 1px solid transparent; font-size: .95rem;
}
.notice .icon { margin-top: 2px; flex: none; }
.notice p:last-child { margin-bottom: 0; }
.notice.success { background: var(--green-bg); border-color: #b7e2c8; color: #0f5132; }
.notice.error   { background: var(--red-bg);   border-color: #f5c2c0; color: #842029; }
.notice.warning { background: var(--orange-bg);border-color: #f3d9a8; color: #7a4a06; }
.notice.info    { background: var(--blue-bg);  border-color: #c3d3fb; color: #1e3a8a; }
.notice.help    { background: var(--brand-tint); border-color: #cfe3e0; color: var(--ink-2); }

.empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: #fff;
}
.empty .icon { color: var(--line-strong); }
.empty h3 { margin: 12px 0 6px; color: var(--ink); }

/* ------------------------------------------------------------- stepper */

.stepper { display: flex; gap: 6px; margin-bottom: 6px; }
.stepper .step {
  flex: 1; height: 8px; border-radius: 999px; background: var(--line);
}
.stepper .step.done { background: var(--brand); }
.stepper .step.current { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.step-label { font-size: .85rem; color: var(--muted); font-weight: 700; margin-bottom: 14px; }

/* -------------------------------------------------------------- rotation */

.sortable { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sortable li {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 62px;
}
.sortable li.dragging { opacity: .45; border-style: dashed; }
.sortable li.dragover { border-color: var(--brand); background: var(--brand-tint); }
.sortable .pos {
  width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--brand-light);
  color: var(--brand-dark); display: grid; place-items: center; font-weight: 800;
}
.sortable .person { flex: 1; min-width: 0; }
.sortable .person strong { display: block; }
.sortable .handle {
  cursor: grab; color: var(--muted); background: none; border: 0; padding: 8px;
  min-width: 40px; min-height: 40px; display: grid; place-items: center; border-radius: 8px;
}
.sortable .handle:active { cursor: grabbing; }
.move-btns { display: flex; flex-direction: column; gap: 2px; }
.move-btns button {
  width: 40px; height: 30px; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 8px; cursor: pointer; color: var(--ink-2); display: grid; place-items: center; padding: 0;
}
.move-btns button:hover { background: var(--brand-tint); border-color: var(--brand); }

/* -------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.timeline li:not(:last-child)::before {
  content: ''; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line);
}
.timeline .marker {
  width: 40px; height: 40px; flex: none; border-radius: 999px; display: grid; place-items: center;
  font-weight: 800; background: var(--grey-bg); color: var(--grey); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
}
.timeline .marker.green { background: var(--green-bg); color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.timeline .marker.orange{ background: var(--orange-bg);color: var(--orange);box-shadow: 0 0 0 2px var(--orange); }
.timeline .marker.red   { background: var(--red-bg);   color: var(--red);   box-shadow: 0 0 0 2px var(--red); }
.timeline .marker.blue  { background: var(--blue-bg);  color: var(--blue);  box-shadow: 0 0 0 2px var(--blue); }
.timeline .body { flex: 1; min-width: 0; padding-top: 2px; }
.timeline .body strong { display: block; }

/* --------------------------------------------------------------- modal */

dialog.modal {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px));
  box-shadow: var(--shadow-lg); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(16,32,29,.5); }
dialog.modal .modal-head {
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
dialog.modal .modal-head h2 { margin: 0; font-size: 1.15rem; }
dialog.modal .modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
dialog.modal .modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--brand-tint);
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
}
dialog.modal .modal-foot .btn { flex: 1; }
.modal-close { background: none; border: 0; cursor: pointer; padding: 6px; color: var(--muted); border-radius: 8px; }
.modal-close:hover { background: var(--grey-bg); }

/* ---------------------------------------------------------------- misc */

.avatar {
  width: 40px; height: 40px; border-radius: 999px; background: var(--brand-light);
  color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; flex: none; font-size: .9rem;
}
.person-row { display: flex; align-items: center; gap: 12px; }
.person-row .person-name { font-weight: 700; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tabs a {
  padding: 12px 16px; text-decoration: none; color: var(--muted); font-weight: 700;
  white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tabs a:hover { color: var(--brand-dark); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }

.notif { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); }
.notif.unread { border-left: 5px solid var(--brand); background: var(--brand-tint); }
.notif .notif-body { flex: 1; min-width: 0; }

.auth-wrap { max-width: 460px; margin: 0 auto; padding: 24px 16px 60px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 26px; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .brand-mark { width: 56px; height: 56px; margin: 0 auto 10px; background: var(--brand); color: #fff; font-size: 1.2rem; border-radius: 16px; }
.auth-logo h1 { margin: 0; font-size: 1.5rem; }
.auth-logo p { color: var(--muted); margin: 4px 0 0; }
.demo-box { background: var(--brand-tint); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 14px; font-size: .88rem; }
.demo-box code { background: #fff; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: .85rem; }

.print-only { display: none; }

/* ---------------------------------------------------------- breakpoints */

@media (min-width: 640px) {
  .grid.two   { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.four  { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .actions-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .btn-row.stack { flex-direction: row; }
  .topbar-user { display: block; }
  h1 { font-size: 1.9rem; }
}

@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .mobilebar { display: none; }
  .layout { display: grid; grid-template-columns: 246px minmax(0,1fr); gap: 26px; padding: 0 24px; }
  .sidenav {
    display: block; padding: 22px 0 40px; position: sticky; top: 76px; align-self: start;
    max-height: calc(100vh - 90px); overflow-y: auto;
  }
  .sidenav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 3px;
    border-radius: 11px; text-decoration: none; color: var(--ink-2); font-weight: 700; min-height: var(--tap);
  }
  .sidenav a:hover { background: var(--brand-tint); color: var(--brand-dark); }
  .sidenav a.active { background: var(--brand-light); color: var(--brand-dark); }
  .sidenav a .icon { color: var(--brand); }
  .sidenav .nav-group-label {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
    font-weight: 800; padding: 16px 14px 6px;
  }
  .sidenav .pip {
    margin-left: auto; background: #f97316; color: #fff; border-radius: 999px;
    min-width: 22px; height: 22px; display: grid; place-items: center; font-size: .72rem;
  }
  .grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(4, minmax(0,1fr)); }
  main { padding: 22px 0 60px; }
}

@media print {
  .topbar, .sidenav, .mobilebar, .btn, .filters, .no-print { display: none !important; }
  body { background: #fff; padding: 0; font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .print-only { display: block; }
  table.data { min-width: 0; font-size: 11px; }
}

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