/* =========================================================================
   Fluent 2 design system — Digital Team Portal
   Tokens follow Microsoft Fluent 2 (web) ramps.
   ========================================================================= */
:root {
  /* Brand ramp (Fluent default brand) */
  --brand-60: #0C3B5E;
  --brand-70: #115EA3;
  --brand-80: #0F6CBD;
  --brand-90: #2886DE;
  --brand-100: #479EF5;
  --brand-tint: #EBF3FC;
  /* Neutrals */
  --n-bg: #F5F5F5;
  --n-bg2: #FAFAFA;
  --n-card: #FFFFFF;
  --n-stroke: #D1D1D1;
  --n-stroke2: #E0E0E0;
  --n-fg: #242424;
  --n-fg2: #616161;
  --n-fg3: #808080;
  /* Status */
  --success: #107C10; --success-bg: #F1FAF1; --success-br: #9FD89F;
  --warning: #BC4B09; --warning-bg: #FFF9F5; --warning-br: #F4BFAB;
  --error:   #C50F1F; --error-bg:   #FDF3F4; --error-br:   #EEACB2;
  --info:    #0F6CBD; --info-bg:    #EBF3FC; --info-br:    #A9C9EE;
  /* Elevation */
  --shadow-2: 0 1px 2px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12);
  --shadow-4: 0 2px 4px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12);
  --shadow-8: 0 4px 8px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12);
  --shadow-16: 0 8px 16px rgba(0,0,0,.14), 0 0 2px rgba(0,0,0,.12);
  /* Shape & type */
  --radius: 4px;
  --radius-lg: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--n-fg);
  background: var(--n-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-80); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  height: 56px;
  background: var(--brand-60);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-4);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; color: var(--brand-60);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  overflow: hidden; flex: none;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark-lg { width: 72px; height: 72px; margin-bottom: 14px; box-shadow: var(--shadow-4); }
.brand-title { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; opacity: .75; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.25; font-size: 12px; text-align: right; }
.topbar-user-meta span { opacity: .75; }
.topbar .btn-subtle { color: #fff; }
.topbar .btn-subtle:hover { background: rgba(255,255,255,.12); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-90); color: #fff;
  display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: calc(100vh - 56px); }
.sidenav {
  width: 220px; flex: none;
  background: var(--n-bg2);
  border-right: 1px solid var(--n-stroke2);
  padding: 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: var(--radius);
  color: var(--n-fg); font-weight: 400;
  position: relative;
}
.nav-item:hover { background: #EBEBEB; text-decoration: none; }
.nav-item.active { background: #EBEBEB; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px; background: var(--brand-80);
}
.nav-icon { font-family: "Segoe Fluent Icons", "Segoe MDL2 Assets"; font-size: 16px; color: var(--brand-80); width: 20px; text-align: center; }

.content { flex: 1; padding: 20px 28px 48px; max-width: 1280px; }
.page-title { font-size: 24px; font-weight: 600; margin: 4px 0 18px; }
.section-title { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--n-card);
  border: 1px solid var(--n-stroke2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
/* Responsive rules live in the "Mobile responsive" section at the end of this file. */

/* Stat tiles */
.stat { text-align: left; }
.stat .stat-label { font-size: 12px; color: var(--n-fg2); }
.stat .stat-value { font-size: 26px; font-weight: 600; margin-top: 2px; }
.stat .stat-sub { font-size: 12px; color: var(--n-fg3); margin-top: 2px; }
.stat-value.good { color: var(--success); }
.stat-value.bad { color: var(--error); }
.stat-value.warn { color: var(--warning); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 14px var(--font);
  padding: 6px 14px; border-radius: var(--radius);
  border: 1px solid var(--n-stroke);
  background: #fff; color: var(--n-fg);
  cursor: pointer; text-decoration: none;
  transition: background .1s;
}
.btn:hover { background: #F5F5F5; text-decoration: none; }
.btn:active { background: #E0E0E0; }
.btn-primary { background: var(--brand-80); border-color: var(--brand-80); color: #fff; }
.btn-primary:hover { background: var(--brand-70); border-color: var(--brand-70); }
.btn-primary:active { background: var(--brand-60); }
.btn-danger { background: #fff; border-color: var(--error-br); color: var(--error); }
.btn-danger:hover { background: var(--error-bg); }
.btn-subtle { border-color: transparent; background: transparent; }
.btn-subtle:hover { background: #EBEBEB; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 15px; border-radius: var(--radius-lg); }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- Forms ---------- */
label.fld { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 4px; color: var(--n-fg); }
input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=email], select, textarea {
  font: 14px var(--font);
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--n-stroke);
  border-bottom-color: #999;
  border-radius: var(--radius);
  background: #fff;
  color: var(--n-fg);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-bottom: 2px solid var(--brand-80);
  padding-bottom: 6px;
}
textarea { resize: vertical; min-height: 64px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- Tables (DataGrid) ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 600; color: var(--n-fg2);
  padding: 8px 10px; border-bottom: 1px solid var(--n-stroke);
  white-space: nowrap; background: var(--n-bg2);
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--n-stroke2); vertical-align: top; }
.tbl tr:hover td { background: #FAFAFA; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 600; background: var(--n-bg2); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.b-green { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-br); }
.b-red { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-br); }
.b-amber { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-br); }
.b-blue { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-br); }
.b-gray { background: #F0F0F0; color: var(--n-fg2); border: 1px solid var(--n-stroke2); }

/* ---------- MessageBar ---------- */
.msgbar {
  display: flex; gap: 10px; align-items: flex-start;
  border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px;
  border: 1px solid;
  font-size: 13.5px;
}
.msg-icon { font-size: 15px; line-height: 1.4; }
.msg-info { background: var(--info-bg); border-color: var(--info-br); }
.msg-info .msg-icon { color: var(--info); }
.msg-success { background: var(--success-bg); border-color: var(--success-br); }
.msg-success .msg-icon { color: var(--success); }
.msg-warning { background: var(--warning-bg); border-color: var(--warning-br); }
.msg-warning .msg-icon { color: var(--warning); }
.msg-error { background: var(--error-bg); border-color: var(--error-br); }
.msg-error .msg-icon { color: var(--error); }

/* Notice cards (prominent, on member dashboard) */
.notice-card {
  border-left: 4px solid var(--brand-80);
  background: var(--brand-tint);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-2);
}
.notice-card.warning { border-left-color: var(--warning); background: var(--warning-bg); }
.notice-card.error { border-left-color: var(--error); background: var(--error-bg); }
.notice-card.success { border-left-color: var(--success); background: var(--success-bg); }
.notice-card h3 { margin: 0 0 4px; font-size: 14px; }
.notice-card .notice-meta { font-size: 11.5px; color: var(--n-fg3); margin-top: 6px; }
.notice-pin { font-size: 11px; font-weight: 700; color: var(--brand-70); letter-spacing: .4px; }

/* ---------- Clock widget ---------- */
.clock-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.clock-time { font-size: 40px; font-weight: 300; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--n-fg2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 13px; }
.kv dt { color: var(--n-fg2); }
.kv dd { margin: 0; font-weight: 600; }

/* Progress / meter */
.meter { height: 8px; background: #E6E6E6; border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand-80); border-radius: 999px; }
.meter > span.warn { background: var(--warning); }

/* Bar charts (analytics) */
.hbar-row { display: grid; grid-template-columns: 220px 1fr 70px; gap: 10px; align-items: center; margin: 7px 0; font-size: 13px; }
.hbar-track { background: #EFEFEF; border-radius: var(--radius); height: 22px; }
.hbar-fill { height: 100%; border-radius: var(--radius); background: var(--brand-80); min-width: 2px; }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--n-fg2); }

/* ---------- Dialog ---------- */
dialog {
  border: none; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-16);
  padding: 24px; width: min(520px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin-top: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-60), var(--brand-80));
}
.login-card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-16);
  padding: 36px 36px 30px; width: min(400px, 92vw);
}
.login-card .brand-mark { width: 46px; height: 46px; font-size: 19px; background: var(--brand-80); color: #fff; margin-bottom: 14px; }
.login-card h1 { font-size: 21px; margin: 0 0 2px; }
.login-card .sub { color: var(--n-fg2); font-size: 12.5px; margin-bottom: 16px; }

/* ---------- Misc ---------- */
.muted { color: var(--n-fg3); }
.small { font-size: 12px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.right { text-align: right; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chip-timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand-70); }
.priority-Urgent { color: var(--error); font-weight: 700; }
.priority-High { color: var(--warning); font-weight: 600; }
.priority-Normal { color: var(--n-fg2); }
.priority-Low { color: var(--n-fg3); }

/* =========================================================================
   TRS v2 — vibrant layer
   ========================================================================= */
:root {
  --v-purple: #6B4EE6; --v-purple-bg: #F0EDFD; --v-purple-br: #C9BEF5;
  --v-teal: #0E9888; --v-pink: #D63384; --v-orange: #E8590C;
  --grad-brand: linear-gradient(120deg, #0C3B5E 0%, #115EA3 55%, #6B4EE6 130%);
  --grad-green: linear-gradient(120deg, #107C10, #4CBB5E);
  --grad-amber: linear-gradient(120deg, #B85C00, #EDA53A);
  --grad-blue:  linear-gradient(120deg, #0F6CBD, #47A2F5);
  --grad-red:   linear-gradient(120deg, #A4262C, #E4606B);
  --grad-purple:linear-gradient(120deg, #5B3CC4, #8F6FF0);
}
.topbar { background: var(--grad-brand); }
.brand-mark { color: #115EA3; font-size: 13px; letter-spacing: .5px; }
.ic { vertical-align: -3px; }
.nav-icon .ic { vertical-align: -4px; }
.msg-icon .ic { vertical-align: -3px; }
.btn .ic { margin-right: 2px; }

/* Gradient stat tiles */
.tile { color: #fff; border: none; border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow-4); }
.tile .stat-label { color: rgba(255,255,255,.85); font-size: 12.5px; font-weight: 600; }
.tile .stat-value { color: #fff; font-size: 30px; font-weight: 700; }
.tile .stat-sub { color: rgba(255,255,255,.8); font-size: 12px; }
.tile .ic { opacity: .9; }
.tile-green { background: var(--grad-green); }
.tile-amber { background: var(--grad-amber); }
.tile-blue  { background: var(--grad-blue); }
.tile-red   { background: var(--grad-red); }
.tile-purple{ background: var(--grad-purple); }
.tile-brand { background: var(--grad-brand); }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; }

/* Priority tags — prominent */
.ptag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .2px;
  color: #fff; white-space: nowrap;
}
.ptag .ic { vertical-align: -2px; }
.p-urgent { background: #C50F1F; }
.p-high   { background: #E8590C; }
.p-2high  { background: #6B4EE6; }
.p-normal { background: #0F6CBD; }
.p-low    { background: #757575; }
.badge.b-purple { background: var(--v-purple-bg); color: var(--v-purple); border: 1px solid var(--v-purple-br); }

/* Notification bell */
.bell-wrap { position: relative; }
.bell-btn { position: relative; color: #fff; }
.bell-badge {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #D13438; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.bell-panel {
  position: absolute; right: 0; top: 42px; width: 360px; max-height: 460px; overflow: auto;
  background: #fff; color: var(--n-fg);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-16); z-index: 100;
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--n-stroke2); }
.bell-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--n-stroke2); color: var(--n-fg); text-decoration: none; }
.bell-item:hover { background: var(--n-bg2); text-decoration: none; }
.bell-item.unread { background: var(--brand-tint); }
.bell-item strong { display: block; font-size: 13px; }
.bell-item .small { color: var(--n-fg2); }
.bell-time { font-size: 11px; color: var(--n-fg3); }

/* Kanban board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; }
.board-col { background: var(--n-bg2); border: 1px solid var(--n-stroke2); border-radius: var(--radius-lg); min-height: 200px; }
.board-col-head { padding: 10px 14px; font-weight: 700; font-size: 13px; border-bottom: 2px solid; display: flex; justify-content: space-between; }
.bc-pending  .board-col-head { border-color: #757575; }
.bc-process  .board-col-head { border-color: #0F6CBD; }
.bc-complete .board-col-head { border-color: #107C10; }
.bc-carried  .board-col-head { border-color: #B85C00; }
.board-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.board-col.dragover { outline: 2px dashed var(--brand-80); outline-offset: -4px; }
.tcard {
  background: #fff; border: 1px solid var(--n-stroke2); border-left: 4px solid var(--brand-80);
  border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow-2); cursor: grab;
  font-size: 13px;
}
.tcard:hover { box-shadow: var(--shadow-8); }
.tcard.prio-Urgent { border-left-color: #C50F1F; }
.tcard.prio-High { border-left-color: #E8590C; }
.tcard.prio-2nd\ High { border-left-color: #6B4EE6; }
.tcard.prio-Low { border-left-color: #757575; }
.tcard-title { font-weight: 600; margin-bottom: 4px; display: block; color: var(--n-fg); }
.tcard-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.tcard-meta .small { color: var(--n-fg3); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--n-stroke2); border: 1px solid var(--n-stroke2); border-radius: var(--radius-lg); overflow: hidden; }
.cal-head { background: var(--n-bg2); font-weight: 700; font-size: 12px; padding: 8px; text-align: center; color: var(--n-fg2); }
.cal-cell { background: #fff; min-height: 96px; padding: 6px; font-size: 12px; }
.cal-cell.other { background: var(--n-bg2); color: var(--n-fg3); }
.cal-cell.today { background: var(--brand-tint); }
.cal-day { font-weight: 700; margin-bottom: 4px; }
.cal-task { display: block; margin: 2px 0; padding: 2px 6px; border-radius: 3px; color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal-task:hover { text-decoration: none; filter: brightness(1.1); }

/* Scroll (wheel) duration picker */
.wheel-picker { display: inline-flex; gap: 6px; align-items: center; }
.wheel { height: 108px; width: 64px; overflow-y: auto; scroll-snap-type: y mandatory; border: 1px solid var(--n-stroke); border-radius: var(--radius); background: #fff; text-align: center; scrollbar-width: none; position: relative; }
.wheel::-webkit-scrollbar { display: none; }
.wheel div { height: 36px; line-height: 36px; scroll-snap-align: center; font-size: 15px; color: var(--n-fg3); }
.wheel div.sel { color: var(--brand-80); font-weight: 700; font-size: 17px; }
.wheel div.pad { pointer-events: none; }
.wheel-label { font-size: 11px; color: var(--n-fg2); text-align: center; margin-top: 2px; }

/* Subtasks & attachments */
.subtask-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--n-stroke2); }
.attach-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--n-stroke2); border-radius: var(--radius); margin: 5px 0; background: var(--n-bg2); font-size: 13px; }
.attach-row img { max-height: 60px; border-radius: 4px; }
.attach-thumb { max-width: 220px; max-height: 160px; border-radius: var(--radius); border: 1px solid var(--n-stroke2); }

/* Day navigation arrows */
.daynav { display: inline-flex; align-items: center; gap: 4px; }
.daynav .btn { padding: 5px 8px; }

/* View switch (list / board / calendar) */
.viewswitch { display: inline-flex; border: 1px solid var(--n-stroke); border-radius: var(--radius); overflow: hidden; }
.viewswitch a { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--n-fg2); display: inline-flex; gap: 6px; align-items: center; }
.viewswitch a:hover { background: var(--n-bg2); text-decoration: none; }
.viewswitch a.active { background: var(--brand-80); color: #fff; }

.locked-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--n-fg2); }
.geo-note { font-size: 12px; color: var(--n-fg2); margin-top: 6px; }
.geo-err { color: var(--error); font-weight: 600; }

/* ---------- Print (PDF reports) ---------- */
@media print {
  .topbar, .sidenav, .toolbar, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: none; padding: 0; }
}
.print-sheet { background: #fff; padding: 24px; }
.print-sheet h1 { font-size: 15px; text-align: center; margin: 0 0 2px; }
.print-sheet .sheet-sub { text-align: center; font-size: 11px; color: #444; margin-bottom: 12px; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 11px; }
.print-sheet th, .print-sheet td { border: 1px solid #999; padding: 4px 6px; }
.print-sheet th { background: #1F4E79; color: #fff; font-weight: 600; }
.print-sheet .lbl { background: #F2F2F2; font-weight: 600; width: 12%; }
.sig-row { display: flex; justify-content: space-between; margin-top: 40px; font-size: 11px; }
.sig-row div { border-top: 1px solid #333; padding-top: 4px; width: 240px; text-align: center; }

/* =========================================================================
   Mobile responsive
   ========================================================================= */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.tbl-wrap { -webkit-overflow-scrolling: touch; }

/* --- Tablet: tighten grids --- */
@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* --- Phone / small tablet: drawer nav + stacked layout --- */
@media (max-width: 900px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; font-size: 12px; }
  .topbar-user-meta { display: none; }
  .topbar-user { gap: 4px; }

  /* hamburger + off-canvas drawer */
  .nav-toggle { display: inline-flex; color: #fff; padding: 6px 8px; }
  .sidenav {
    position: fixed; left: 0; top: 56px; bottom: 0;
    width: min(280px, 82vw);
    background: #fff;
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 90;
    overflow-y: auto;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
    border-right: 1px solid var(--n-stroke2);
  }
  body.nav-open .sidenav { transform: none; box-shadow: var(--shadow-16); }
  .nav-backdrop { position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.42); z-index: 85; }
  body.nav-open .nav-backdrop { display: block; }
  body.nav-open { overflow: hidden; }
  .nav-item { padding: 12px 14px; font-size: 15px; }

  .content { padding: 14px 12px 44px; max-width: none; }
  .page-title { font-size: 19px; margin: 2px 0 14px; }
  .section-title { font-size: 15px; }
  .card { padding: 14px 14px; border-radius: var(--radius); }

  .grid { gap: 10px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .tile { padding: 12px 14px; }
  .tile .stat-value { font-size: 24px; }
  .stat .stat-value { font-size: 21px; }

  /* forms stack */
  .form-row { flex-direction: column; gap: 0; }
  .inline-form { gap: 6px; }
  .toolbar { gap: 6px; }
  .toolbar form.inline-form { width: 100%; }
  .toolbar select, .toolbar input[type=date], .toolbar input[type=month] { max-width: 100%; }

  /* clock hero stacks and centers */
  .clock-hero { flex-direction: column; align-items: stretch; gap: 12px; text-align: center; }
  .clock-hero .kv { text-align: left; }
  .clock-time { font-size: 32px; }
  .clock-hero .btn-lg { justify-content: center; width: 100%; }

  /* data tables scroll sideways instead of crushing */
  .tbl-wrap .tbl { min-width: 660px; }

  /* dialogs near full-screen */
  dialog { width: calc(100vw - 20px); max-height: 88vh; overflow-y: auto; padding: 16px 14px; }
  .dlg-actions { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }

  /* notification panel spans the screen */
  .bell-panel { position: fixed; left: 8px; right: 8px; top: 62px; width: auto; max-height: 70vh; }

  /* kanban: swipeable columns */
  .board { grid-template-columns: repeat(4, min(78vw, 300px)); gap: 10px; scroll-snap-type: x proximity; padding-bottom: 6px; }
  .board-col { scroll-snap-align: start; }

  /* calendar: swipe sideways */
  .cal-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-wrap .cal { min-width: 640px; }
  .cal-cell { min-height: 78px; }

  /* wheel picker layout */
  .wheel-picker { justify-content: center; width: 100%; }

  .attach-thumb { max-width: 100%; }
  .hbar-row { grid-template-columns: 110px 1fr 58px; font-size: 12px; }
  .viewswitch { width: 100%; }
  .viewswitch a { flex: 1; justify-content: center; padding: 8px 6px; }
  .daynav { width: 100%; justify-content: center; }
  .login-card { padding: 26px 20px 22px; }
  .notice-card { padding: 10px 12px; }
}

/* --- Small phones --- */
@media (max-width: 420px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile .stat-value { font-size: 21px; }
  .tile .stat-label { font-size: 11px; }
  .page-title { font-size: 17px; }
  .btn-lg { padding: 10px 14px; font-size: 14px; }
  .kv { grid-template-columns: auto 1fr; font-size: 12.5px; }
}

/* --- Touch devices: comfortable tap targets --- */
@media (pointer: coarse) {
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; }
  .nav-item { min-height: 44px; }
  input[type=text], input[type=password], input[type=date], input[type=time],
  input[type=number], input[type=email], input[type=month], select { min-height: 40px; }
  .bell-btn { min-width: 40px; }
  .subtask-row { padding: 10px 0; }
  .wheel div { height: 40px; line-height: 40px; }
  .wheel { height: 120px; }
}

/* =========================================================================
   Round 3 — spacing fixes + new components
   ========================================================================= */

/* Spacing rhythm: tile grids were flush against the next card */
.grid { margin-bottom: 16px; }
.grid .card, .grid .tile { margin-bottom: 0; }
.tile .stat-value { margin-top: 4px; }
.toolbar { margin-bottom: 16px; row-gap: 10px; }
.msgbar { margin-bottom: 12px; }
.section-title { margin: 22px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* ---------- Global search (topbar) ---------- */
.topbar-search {
  position: relative; flex: 1; max-width: 420px; margin: 0 18px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.14); border-radius: var(--radius);
  padding: 0 10px; height: 34px; color: #fff;
}
.topbar-search input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #fff; font: 13.5px var(--font); min-height: 0; padding: 0;
}
.topbar-search input::placeholder { color: rgba(255,255,255,.65); }
.topbar-search:focus-within { background: #fff; color: var(--n-fg2); }
.topbar-search:focus-within input { color: var(--n-fg); }
.search-panel {
  position: absolute; top: 40px; left: 0; right: 0;
  background: #fff; color: var(--n-fg);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-16);
  max-height: 420px; overflow-y: auto; z-index: 120;
}
.search-group { padding: 8px 14px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--n-fg3); }
.search-item { display: block; padding: 8px 14px; color: var(--n-fg); font-size: 13.5px; border-bottom: 1px solid var(--n-bg); }
.search-item span { display: block; }
.search-item:hover { background: var(--brand-tint); text-decoration: none; }

/* ---------- Asana-style list grouping ---------- */
.tgroup-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  padding: 12px 10px 6px; border-bottom: 2px solid var(--n-stroke2);
}
.tgroup-head .count { font-weight: 600; color: var(--n-fg3); }
.tg-overdue { color: var(--error); border-color: var(--error-br); }
.tg-today { color: var(--brand-70); border-color: var(--info-br); }
.tg-upcoming { color: var(--n-fg2); }
.tg-done { color: var(--success); border-color: var(--success-br); }
.tg-awaiting { color: var(--v-purple); border-color: var(--v-purple-br); }
.tg-rejected { color: var(--error); border-color: var(--error-br); }
.trow {
  display: grid; grid-template-columns: 26px 1fr 130px 110px 90px 110px; gap: 10px;
  align-items: center; padding: 9px 10px; border-bottom: 1px solid var(--n-stroke2);
  font-size: 13.5px;
}
.trow:hover { background: var(--n-bg2); }
.trow .t-title { font-weight: 600; color: var(--n-fg); }
.trow .t-title:hover { text-decoration: underline; }
.trow .t-sub { font-size: 12px; color: var(--n-fg3); font-weight: 400; }
.trow input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--success); }
.t-complete .t-title { text-decoration: line-through; color: var(--n-fg3); }
@media (max-width: 900px) {
  .trow { grid-template-columns: 24px 1fr 96px; }
  .trow .t-col-hide { display: none; }
}

/* Quick add row */
.quickadd {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px dashed var(--n-stroke);
  border-radius: var(--radius); margin-bottom: 10px; background: var(--n-bg2);
}
.quickadd input[type=text] { border: none; background: transparent; font-size: 14px; }
.quickadd input[type=text]:focus { border: none; padding-bottom: 7px; }
.quickadd .qa-icon { color: var(--brand-80); flex: none; }
.quickadd .qa-hint { flex: none; font-size: 11.5px; color: var(--n-fg3); white-space: nowrap; }

/* ---------- Task comments ---------- */
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--n-stroke2); }
.comment-body { flex: 1; }
.comment-head { font-size: 12.5px; margin-bottom: 3px; }
.comment-head strong { margin-right: 6px; }
.comment-head .muted { font-size: 11.5px; }
.comment-text { font-size: 13.5px; white-space: pre-wrap; }

/* ---------- Checkbox grids (users form) ---------- */
.check-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px;
  border: 1px solid var(--n-stroke); border-radius: var(--radius);
  padding: 8px 10px; max-height: 180px; overflow-y: auto; background: #fff;
}
.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 400; padding: 3px 0; cursor: pointer; }
.chk input { width: 15px; height: 15px; min-height: 0; accent-color: var(--brand-80); flex: none; }

/* ---------- Analytics charts ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: 1fr 1fr; } }
.colchart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.colchart .colbar { flex: 1; min-width: 6px; background: var(--grad-blue); border-radius: 3px 3px 0 0; position: relative; }
.colchart .colbar.weekend { background: #E0E0E0; }
.colchart .colbar:hover::after {
  content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--n-fg); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; z-index: 5;
}
.colchart-x { display: flex; gap: 3px; font-size: 9.5px; color: var(--n-fg3); }
.colchart-x span { flex: 1; text-align: center; overflow: hidden; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { font-size: 13px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.donut-legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* Entry rows from rejected attempts */
.entry-rejected { opacity: .6; }
.entry-rejected td:first-child::before { content: "✕ "; color: var(--error); }
.attempt-chip { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--error-bg); color: var(--error); border: 1px solid var(--error-br); }

/* =========================================================================
   Day timeline (task time blocks)
   ========================================================================= */
.timeline { display: grid; grid-template-columns: 64px 1fr; gap: 0; position: relative;
  min-height: calc(var(--rows, 10) * 46px); }
.tl-axis { position: relative; }
.tl-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--n-fg3); white-space: nowrap; }
.tl-track { position: relative; border-left: 2px solid var(--n-stroke); background: var(--n-bg2); border-radius: 0 var(--radius) var(--radius) 0; overflow: hidden; }
.tl-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--n-stroke2); }
.tl-window { position: absolute; left: 0; right: 0; background: var(--success-bg);
  border-top: 1px solid var(--success-br); border-bottom: 1px solid var(--success-br); }
.tl-block { position: absolute; left: 8px; right: 8px; min-height: 18px;
  border-radius: var(--radius); color: #fff; padding: 3px 8px; overflow: hidden;
  box-shadow: var(--shadow-2); text-decoration: none; display: flex; flex-direction: column; gap: 1px; }
.tl-block:hover { filter: brightness(1.08); text-decoration: none; box-shadow: var(--shadow-8); z-index: 3; }
.tl-block-time { font-size: 10.5px; opacity: .9; font-variant-numeric: tabular-nums; }
.tl-block-title { font-size: 12.5px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-rejected { opacity: .45; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 6px, transparent 6px 12px); }
.tl-legend { display: inline-flex; align-items: center; gap: 6px; }
.tl-swatch { width: 22px; height: 12px; border-radius: 3px; display: inline-block; }
@media (max-width: 900px) { .timeline { grid-template-columns: 50px 1fr; } .tl-hour { font-size: 10px; right: 5px; } }
