/* IET shared look — used by IT Hub, Ticketing, Zebra Fleet Portal.
   Mobile-first. Same tokens as Asset Inventory. */
:root {
  --ink: #1a1f24;
  --muted: #5c6770;
  --paper: #e8ecef;
  --paper-2: #f4f6f7;
  --line: rgba(26, 31, 36, 0.12);
  --accent: #f0b429;
  --accent-deep: #c48a00;
  --danger: #9b2c2c;
  --danger-bg: #fde8e8;
  --ok: #1f7a4c;
  --ok-bg: #e3f6ec;
  --info: #1a4b8c;
  --info-bg: #e8f1fb;
  --warn: #9a6700;
  --warn-bg: #fff0d6;
  --radius: 1rem;
  --touch: 3.15rem;
  --gutter: max(1.2rem, env(safe-area-inset-left, 0px));
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font); font-size: 1.02rem; line-height: 1.5;
  color: var(--ink); background: linear-gradient(180deg, #f7f8f9 0%, #e6ebf0 100%) fixed;
  -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent-deep); }
a, button, input, select, textarea, summary { touch-action: manipulation; -webkit-tap-highlight-color: rgba(26,31,36,.08); }
.mono { font-family: var(--mono); font-weight: 600; letter-spacing: -0.02em; }

/* Header */
.shell-header {
  position: sticky; top: 0; z-index: 40; background: rgba(247,248,249,.97); border-bottom: 1px solid var(--line);
  padding: max(.75rem, env(safe-area-inset-top)) var(--gutter) 1rem;
}
.brand-row { max-width: 72rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem .55rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  font-family: var(--display); font-weight: 800; font-size: 1.55rem; letter-spacing: -.04em; line-height: 1;
  background: var(--accent); color: var(--ink); padding: .14rem .42rem .2rem; border-radius: .35rem; transform: rotate(-1.5deg); display: inline-block;
}
.brand-sub { font-family: var(--display); font-weight: 650; font-size: 1.22rem; letter-spacing: -.03em; line-height: 1.2; }
.mode-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .15rem; padding: .28rem; background: rgba(26,31,36,.06); border-radius: .95rem; }
.mode-link {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; padding: .75rem .45rem; min-height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center; border-radius: .75rem; transition: background .2s, color .2s;
}
.mode-link.is-on { background: var(--ink); color: #fff; }
.mode-link em { font-style: normal; font-family: var(--mono); font-size: .82em; opacity: .85; margin-left: .25rem; }
.header-meta { max-width: 72rem; margin: 1rem auto 0; display: flex; flex-direction: column; gap: .9rem; }
.session-box {
  display: flex; align-items: center; justify-content: space-between; gap: .85rem; padding: .7rem .95rem; min-height: var(--touch);
  background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: var(--radius);
}
.session-user { font-weight: 700; font-size: .92rem; }
.session-logout { font-weight: 600; font-size: .88rem; text-decoration: none; }

/* Layout */
.shell { max-width: 42rem; margin: 0 auto; padding: 1.35rem var(--gutter) max(3.5rem, calc(2rem + env(safe-area-inset-bottom))); }
.shell-wide { max-width: 72rem; }
.page-hero { margin-bottom: 1.65rem; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: .85rem; margin-bottom: .5rem; }
.eyebrow { margin: 0 0 .35rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-deep); }
h1 { font-family: var(--display); font-weight: 750; font-size: clamp(1.65rem, 6.2vw, 2.55rem); letter-spacing: -.035em; line-height: 1.12; margin: 0 0 .55rem; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; margin: 0; }
h3 { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.lede { margin: 0; color: var(--muted); max-width: 38rem; line-height: 1.55; }
.lede strong { color: var(--ink); }
.back { margin: 0 0 1rem; font-weight: 600; }
.back a { text-decoration: none; }
.site-badge {
  flex-shrink: 0; font-family: var(--mono); font-weight: 700; font-size: 1rem; letter-spacing: .04em; background: var(--ink); color: var(--accent);
  padding: .4rem .7rem; border-radius: .45rem; line-height: 1;
}

/* Panels, lists */
.panel { background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: calc(var(--radius) + .2rem); padding: 1.45rem 1.25rem 1.35rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.action-list { display: grid; gap: .65rem; }
.action-row {
  display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 1.15rem; min-height: 3.85rem;
}
.action-row:active { transform: scale(.99); }
.action-title { display: block; font-weight: 700; font-size: 1.05rem; }
.action-meta { display: block; margin-top: .2rem; color: var(--muted); font-size: .9rem; }
.action-row.is-muted { border-left-color: rgba(26,31,36,.2); opacity: .8; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; }

/* Tiles (hub) */
.tile-grid { display: grid; gap: .85rem; }
.tile {
  display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: calc(var(--radius) + .1rem);
  padding: 1.35rem 1.25rem; min-height: 6.5rem; position: relative; overflow: hidden;
}
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--accent); }
.tile.is-soon::before { background: rgba(26,31,36,.18); }
.tile-title { display: block; font-family: var(--display); font-weight: 750; font-size: 1.25rem; letter-spacing: -.02em; }
.tile-desc { display: block; margin-top: .35rem; color: var(--muted); }
.tile-tag { display: inline-block; margin-top: .75rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Forms */
.form label, .field { display: block; margin: 0 0 1.5rem; font-size: .95rem; font-weight: 700; letter-spacing: .01em; color: var(--ink); }
.form input, .form select, .form textarea, .filter {
  display: block; width: 100%; margin-top: .55rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
  font: inherit; font-weight: 500; font-size: 1.125rem; line-height: 1.35; min-height: var(--touch); padding: 1rem 1.1rem;
}
.form textarea { min-height: 8rem; resize: vertical; }
.filter { margin-top: 0; }
.form input:focus, .form select:focus, .form textarea:focus, .filter:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.form input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 1px; }
.optional { font-weight: 500; color: var(--muted); }
.help { display: block; margin-top: .4rem; font-weight: 400; font-size: .88rem; color: var(--muted); }
.form-row { display: grid; gap: 0; }
.check-row { display: flex !important; align-items: center; gap: .6rem; font-weight: 600 !important; }
.check-row input { width: auto !important; min-height: 0; margin: 0 !important; transform: scale(1.35); }
.primary, .danger, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; border: 0; border-radius: var(--radius); font: inherit; font-weight: 700;
  font-size: 1.1rem; text-decoration: none; cursor: pointer; min-height: 3.35rem; padding: 1.1rem 1.2rem; margin: .55rem 0 0;
}
.primary { background: var(--ink); color: #fff; }
.primary:disabled { opacity: .6; cursor: default; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.danger { background: var(--danger); color: #fff; }
.danger-link {
  display: block; text-align: center; text-decoration: none; color: var(--danger); font-weight: 700; padding: 1rem; margin-top: 1rem;
  border: 1px solid rgba(155,44,44,.25); border-radius: var(--radius); background: var(--danger-bg);
}
.field-error { margin: -.9rem 0 1.1rem; color: var(--danger); font-size: .88rem; font-weight: 600; }

/* Banners, chips */
.banner { border-radius: var(--radius); padding: .95rem 1.1rem; font-weight: 600; margin: 0 0 1rem; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.error { background: var(--danger-bg); color: var(--danger); }
.banner.info { background: var(--info-bg); color: var(--info); }
.chip {
  display: inline-block; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .3rem .6rem; border-radius: .45rem;
  background: rgba(26,31,36,.07); color: var(--ink); white-space: nowrap;
}
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-muted { background: #e8e8e8; color: #555; }

/* Scope switch & tools */
.scope-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .45rem; margin: 0 0 1.1rem; padding: .3rem; background: rgba(26,31,36,.06); border-radius: var(--radius); }
.scope-link {
  text-align: center; text-decoration: none; color: var(--muted); font-weight: 600; padding: .9rem .55rem; min-height: var(--touch); display: flex; align-items: center;
  justify-content: center; gap: .25rem; border-radius: calc(var(--radius) - .15rem);
}
.scope-link em { font-style: normal; font-family: var(--mono); font-size: .85em; }
.scope-link.is-on { background: #fff; color: var(--ink); }
.tools { display: flex; flex-direction: column; gap: .75rem; margin: 0 0 1.15rem; }
.tools .btn-secondary { margin: 0; }

/* Tables (desktop) */
.table-scroll { overflow-x: auto; background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: calc(var(--radius) + .1rem); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 40rem; }
.table th, .table td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: rgba(232,236,239,.65); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--accent); }
.desktop-only { display: none; }

/* Comments / timeline */
.timeline { display: grid; gap: .75rem; margin-top: 1rem; }
.note { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.note-meta { display: flex; justify-content: space-between; gap: .75rem; color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.note p { margin: 0; white-space: pre-wrap; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; font-weight: 600; }
.dl dd { margin: 0; font-weight: 500; }

/* Login */
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 1.35rem var(--gutter) 1.5rem; }
.login-shell { width: min(100%, 26rem); }
.login-brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem .5rem; margin-bottom: 1.35rem; }
.login-help { margin: 1rem 0 0; color: var(--muted); font-size: .92rem; }
.footer-link { margin-top: 1.75rem; font-weight: 600; }

@media (min-width: 48rem) {
  body { font-size: 1.05rem; }
  .shell-header { padding: .85rem 1.15rem 1rem; backdrop-filter: blur(14px); background: rgba(244,246,247,.92); }
  .brand-row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .85rem 1rem; }
  .brand-mark { font-size: clamp(1.45rem, 4.5vw, 2.1rem); }
  .brand-sub { font-size: clamp(1.05rem, 3.4vw, 1.4rem); }
  .mode-switch { display: inline-flex; border-radius: 999px; padding: .22rem; }
  .mode-link { padding: .65rem .95rem; border-radius: 999px; }
  .header-meta { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .shell { padding-top: 1.75rem; }
  .panel-head { flex-direction: row; align-items: center; justify-content: space-between; }
  .panel-head .filter { max-width: 16rem; }
  .action-list, .tile-grid { grid-template-columns: 1fr 1fr; }
  .tile-grid { gap: 1rem; }
  .tools { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .tools .filter { flex: 1; min-width: 14rem; }
  .tools .btn-secondary { width: auto; }
  .form-row { grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .primary, .danger { width: auto; min-width: 12rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.mode-switch { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.session-actions { display: flex; align-items: center; gap: .75rem; }
.inline-form { display: inline; margin: 0; }
.session-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; margin: 0 0 1.25rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat-n { font-family: var(--display); font-weight: 750; font-size: 1.55rem; letter-spacing: -.03em; }
.stat-l { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat-warn { background: var(--warn-bg); }
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.secret-row { display: flex; flex-wrap: wrap; gap: .45rem; align-items: stretch; }
.secret-row input { flex: 1; min-width: 10rem; margin-top: 0 !important; }
.secret-btn { width: auto !important; min-height: var(--touch); margin: 0 !important; padding: .6rem 1rem !important; }
.md-editor { min-height: 22rem !important; font-family: var(--mono); font-size: .95rem; }
.mono-input { font-family: var(--mono); }
.md-body { line-height: 1.55; overflow-x: auto; }
.md-body h1, .md-body h2, .md-body h3 { font-family: var(--display); }
.md-body h1 { font-size: 1.45rem; }
.md-body h2 { font-size: 1.15rem; margin-top: 1.4rem; }
.md-body table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .75rem 0; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.md-body th { background: rgba(232,236,239,.65); }
.md-body pre, .mail-body { font-family: var(--mono); font-size: .85rem; white-space: pre-wrap; background: var(--paper-2); padding: .85rem; border-radius: .75rem; overflow-x: auto; }
.filter-date { font-size: .82rem; font-weight: 700; color: var(--muted); }
body.iet-reading .shell-header,
body.iet-reading .reading-hide { display: none !important; }
body.iet-reading .shell { max-width: 42rem; }

body.iet-print .shell-header,
body.iet-print .no-print { display: none !important; }

@media print {
  .shell-header, .no-print, .reading-hide, .tools, form.form, .session-box, .mode-switch { display: none !important; }
  body { background: #fff !important; color: #111; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
  .shell { max-width: none; padding: 0; }
  .panel { break-inside: avoid; page-break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .history-print-entry { break-inside: avoid; page-break-inside: avoid; margin-bottom: 1.25rem; }
  .md-body th, .md-body td { border-color: #999; }
  .brand-mark { background: #ddd !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
