/* T&W Event Admin — Polaris-skinned admin shell.
   Colour, radius, shadow and type values lifted from Shopify Polaris v13
   design tokens so the app reads as Shopify admin: black top bar, light grey
   sidebar, #f1f1f1 canvas, white cards (radius 12), near-black primary
   actions, tonal badges, #005bd3 focus/links. Dense by design. */

:root {
  /* Polaris v13 tokens (subset) */
  --bg: #f1f1f1;                  /* --p-color-bg */
  --surface: #ffffff;             /* --p-color-bg-surface */
  --surface-sec: #f7f7f7;         /* --p-color-bg-surface-secondary */
  --surface-hover: #f7f7f7;
  --text: #303030;                /* --p-color-text */
  --text-sub: #616161;            /* --p-color-text-secondary */
  --border: #e3e3e3;              /* --p-color-border */
  --border-sec: #ebebeb;
  --border-input: #8a8a8a;        /* input borders are darker in Polaris */
  --link: #005bd3;                /* --p-color-text-link */
  --focus: #005bd3;
  --fill-brand: #303030;          /* primary buttons are near-black */
  --fill-brand-hover: #1a1a1a;
  --frame: #1a1a1a;               /* top bar */
  --nav-bg: #ebebeb;              /* sidebar */
  --nav-hover: #e0e0e0;
  --nav-active: #ffffff;

  /* badge tones */
  --tone-success-bg: #cdfee1; --tone-success-tx: #0c5132;
  --tone-warn-bg:    #ffef9d; --tone-warn-tx:    #4f4700;
  --tone-crit-bg:    #fedad9; --tone-crit-tx:    #8e1f0b;
  --tone-info-bg:    #eaf4ff; --tone-info-tx:    #00527c;
  --tone-def-bg:     #e3e3e3; --tone-def-tx:     #303030;

  --radius-card: 12px;            /* --p-border-radius-300 */
  --radius-btn: 8px;              /* --p-border-radius-200 */
  --shadow-card: 0 1px 0 rgba(26,26,26,.07);
  --shadow-bevel: inset 0 -1px 0 #b5b5b5;
  --shadow-lg: 0 8px 32px rgba(26,26,26,.2);
  --sidebar-w: 216px;
  --appbar-h: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 450 13px/1.45 Inter, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ---------------- app bar (always) ---------------- */
.appbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--appbar-h);
  background: var(--frame); color: #e3e3e3;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
}
.appbar .crest {
  width: 26px; height: 26px; border-radius: 6px;
  background: #ac410c; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px; letter-spacing: .5px;
}
.appbar .t { font-weight: 600; font-size: 13px; color: #fff; }
.appbar .s { font-size: 11.5px; color: #999; }
.appbar .spacer { flex: 1; }
.appbar .reset {
  background: none; border: 0; color: #999; font-size: 12px; padding: 4px 8px; border-radius: 6px;
}
.appbar .reset:hover { background: #303030; color: #fff; }

/* ---------------- shell ---------------- */
.shell { display: flex; min-height: calc(100vh - var(--appbar-h)); }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto;
  background: var(--nav-bg);
  display: flex; flex-direction: column;
  position: sticky; top: var(--appbar-h); height: calc(100vh - var(--appbar-h));
}
.nav { padding: 10px 8px; flex: 1 1 auto; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; margin: 1px 0; border-radius: var(--radius-btn);
  color: var(--text); font-weight: 550; font-size: 12.5px;
}
.nav a:hover { background: var(--nav-hover); text-decoration: none; }
.nav a.active { background: var(--nav-active); box-shadow: var(--shadow-card); font-weight: 650; }
.nav a .ic { width: 17px; text-align: center; font-size: 13px; }
.nav a .badge {
  margin-left: auto; background: rgba(0,0,0,.08); color: var(--text-sub);
  font-size: 10.5px; font-weight: 600; border-radius: 9px; padding: 1px 7px;
}
.nav a.active .badge { background: #f1f1f1; color: var(--text); }
.nav .sep { margin: 10px 8px 5px; font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-sub); font-weight: 600; }
.sidebar .foot { padding: 10px 14px; font-size: 10.5px; color: var(--text-sub); }
.sidebar .foot button { background: none; border: 0; color: var(--text-sub); padding: 0; font-size: 10.5px; text-decoration: underline; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

/* mobile tabs under the app bar */
.tabs {
  display: none; position: sticky; top: var(--appbar-h); z-index: 50;
  background: var(--frame);
  gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 0 8px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; padding: 8px 12px 10px; font-size: 12px; font-weight: 550;
  color: #a5a5a5; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { text-decoration: none; color: #fff; }
.tabs a.active {
  color: #fff; font-weight: 700;
  background: #333; border-radius: 8px 8px 0 0;
  border-bottom-color: #ac410c;
}

.content { padding: 16px 20px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------------- page head ---------------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.1px; }
.page-head .count { color: var(--text-sub); font-size: 12px; }
.page-head .spacer { flex: 1 1 auto; }

/* Polaris buttons: white with a bottom bevel; primary near-black */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid #d4d4d4; border-radius: var(--radius-btn);
  padding: 5px 12px; font-size: 12px; font-weight: 550;
  box-shadow: var(--shadow-bevel), 0 1px 0 rgba(26,26,26,.05);
}
.btn:hover { background: #fafafa; }
.btn:active { box-shadow: inset 0 2px 1px rgba(26,26,26,.12); }
.btn.primary {
  background: var(--fill-brand); border-color: var(--fill-brand); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 1px 0 rgba(26,26,26,.1);
}
.btn.primary:hover { background: var(--fill-brand-hover); }
.btn.danger { color: var(--tone-crit-tx); border-color: #e0b4ab; }
.btn.sm { padding: 4px 10px; font-size: 11.5px; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--text-sub); }
.btn.ghost:hover { background: rgba(0,0,0,.06); color: var(--text); }

/* icon buttons */
.ico { display: inline-flex; }
.ico svg { width: 14px; height: 14px; }
.btn .ico + * { margin-left: 2px; }
.btn.iconbtn { padding-left: 8px; padding-right: 8px; min-width: 32px; }

/* ---------------- toolbar ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border); border-bottom: 1px solid var(--border-sec);
  border-radius: var(--radius-card) var(--radius-card) 0 0; padding: 8px 10px;
}
.search {
  flex: 1 1 200px; min-width: 150px; display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius-btn);
  padding: 4px 10px;
}
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search input { border: 0; outline: 0; width: 100%; font-size: 12.5px; background: transparent; color: var(--text); -webkit-text-fill-color: var(--text); }
.search .ic { color: var(--text-sub); font-size: 12px; }

/* single-line scroll strip, not a stack — chips run off the edge and swipe */
.chips {
  display: flex; gap: 5px; flex-wrap: nowrap;
  flex: 1 1 260px; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 1px;
  /* fade the clipped edge so it reads as scrollable */
  mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; }
/* inside the filter panel there's room — wrap normally */
.chips.wrap { flex-wrap: wrap; overflow: visible; flex: initial;
  mask-image: none; -webkit-mask-image: none; }

/* filter button + dropdown panel */
.btn.filter-on { border-color: var(--fill-brand); }
.fcount {
  background: var(--fill-brand); color: #fff; font-size: 10px; font-weight: 650;
  border-radius: 999px; padding: 1px 6px; margin-left: 4px;
}
.filterpanel {
  background: var(--surface); border: 1px solid var(--border); border-top: 0;
  padding: 7px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start;
  position: relative; z-index: 20;
  box-shadow: 0 3px 6px -2px rgba(26,26,26,.12);
  background: var(--surface-sec);
}
.fspacer { flex: 1 1 auto; }
.fmeta { font-size: 11px; color: var(--text-sub); align-self: center; white-space: nowrap; }

/* dropdown tick-lists, one per filter dimension */
.fdd { position: relative; }
.fdd-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid #d4d4d4; border-radius: var(--radius-btn);
  padding: 4px 10px; font-size: 12px; font-weight: 550; color: var(--text);
}
.fdd-btn.has { border-color: var(--fill-brand); }
.fdd-btn .caret { font-size: 9px; color: var(--text-sub); }
.fdd.open .fdd-btn { background: var(--surface-sec); }
.fdd-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 70;
  min-width: 200px; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-btn); box-shadow: var(--shadow-lg);
  padding: 4px;
}
.fdd-opt {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; border-radius: 6px;
  padding: 6px 8px; font-size: 12.5px; text-align: left; color: var(--text);
}
.fdd-opt:hover { background: var(--surface-sec); }
.fdd-opt .tick { width: 14px; height: 14px; display: inline-flex; visibility: hidden; flex: 0 0 auto; }
.fdd-opt .tick svg { width: 14px; height: 14px; }
.fdd-opt.on { font-weight: 600; }
.fdd-opt.on .tick { visibility: visible; }
.fdd-opt .n { margin-left: auto; color: var(--text-sub); font-size: 11px; }
.chip {
  border: 0; background: var(--tone-def-bg);
  border-radius: 999px; padding: 3px 11px; font-size: 11.5px; font-weight: 550;
  color: var(--text);
}
.chip:hover { background: #d4d4d4; }
.chip.on { background: var(--fill-brand); color: #fff; }

/* ---------------- table ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card);
}
.tablewrap { border-radius: 0 0 var(--radius-card) var(--radius-card); border-top: 0; overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-sub);
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  background: var(--surface-sec); white-space: nowrap;
  position: sticky; top: 0;
}
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--text); }
table.grid td {
  padding: 6px 10px; border-bottom: 1px solid var(--border-sec);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--surface-hover); }
td .main-cell { font-weight: 550; }
td .sub-cell { color: var(--text-sub); font-size: 11.5px; }
.sub-cell { color: var(--text-sub); font-size: 11.5px; }
.empty { padding: 34px 16px; text-align: center; color: var(--text-sub); font-size: 12.5px; }

.selcell { width: 30px; text-align: center; }
.selcell input { width: 14px; height: 14px; accent-color: var(--fill-brand); cursor: pointer; }

/* bulk actions bar */
.bulkbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--frame); color: #fff; font-size: 12px;
  padding: 7px 10px; border: 1px solid var(--border); border-bottom: 0;
}
.bulkbar select {
  background: #303030; color: #fff; border: 1px solid #454545;
  border-radius: var(--radius-btn); padding: 4px 8px; font-size: 12px;
}
.bulkbar .btn { box-shadow: none; }
.bulkbar .btn.ghost { color: #b5b5b5; }
.bulkbar .btn.ghost:hover { background: #303030; color: #fff; }

/* status badges — Polaris tones */
.pill {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 1.5px 9px; font-size: 11px; font-weight: 550;
  white-space: nowrap;
  background: var(--tone-def-bg); color: var(--tone-def-tx);
}
.pill.requested { background: var(--tone-warn-bg); color: var(--tone-warn-tx); }
.pill.confirmed { background: var(--tone-success-bg); color: var(--tone-success-tx); }
.pill.waitlist  { background: var(--tone-info-bg);  color: var(--tone-info-tx); }
.pill.declined  { background: var(--tone-crit-bg);  color: var(--tone-crit-tx); }
.pill.cancelled { background: var(--tone-def-bg);   color: var(--text-sub); }
.pill.paid      { background: var(--tone-success-bg); color: var(--tone-success-tx); }
.pill.unpaid    { background: var(--tone-def-bg);   color: var(--text-sub); }
.pill.invoiced  { background: var(--tone-info-bg);  color: var(--tone-info-tx); }

/* ---------------- dashboard ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 14px;
}
@media (min-width: 1100px) { .stat-grid { grid-template-columns: repeat(6, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 10px 12px; cursor: pointer;
}
.stat:hover { background: var(--surface-sec); }
.stat .k { font-size: 11px; font-weight: 600; color: var(--text-sub); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 20px; font-weight: 700; margin: 3px 0 5px; letter-spacing: -.3px; }
.stat .b { display: flex; gap: 4px; flex-wrap: wrap; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel-h {
  font-size: 12.5px; font-weight: 650; padding: 9px 12px;
  border-bottom: 1px solid var(--border-sec); display: flex; align-items: center;
  background: var(--surface-sec);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.panel-h .spacer { flex: 1; }
.list-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-bottom: 1px solid var(--border-sec); cursor: pointer; font-size: 12.5px;
}
.list-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.list-item:hover { background: var(--surface-hover); }
.list-item .who { font-weight: 550; }
.list-item .what { color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .when { margin-left: auto; color: var(--text-sub); font-size: 11px; flex: 0 0 auto; }

/* ---------------- drawer ---------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(26,26,26,.4);
  z-index: 90; opacity: 0; transition: opacity .18s;
}
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(560px, 100vw); background: var(--bg);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .2s ease;
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer-head {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.drawer-head h2 { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: -.1px; }
.drawer-head .sub { flex-basis: 100%; color: var(--text-sub); font-size: 11.5px; margin-top: -4px; }
.drawer-head .x { margin-left: auto; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 40px; }

.sec-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); margin-bottom: 12px; }
.sec-card .h {
  padding: 8px 12px; border-bottom: 1px solid var(--border-sec);
  font-size: 12px; font-weight: 650; display: flex; align-items: center; gap: 8px;
  background: var(--surface-sec);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.sec-card .h .spacer { flex: 1; }
/* buttons that live inside card headers stay slim */
.sec-card .h .btn, .panel-h .btn { padding: 2px 9px; font-size: 11.5px; min-height: 24px; }
.sec-card .b { padding: 10px 12px; }
.sec-card .b.compact { padding: 8px 12px; }
.srlabel { font-size: 10.5px; font-weight: 650; letter-spacing: .3px; text-transform: uppercase; color: var(--text-sub); margin: 0 0 5px; }
.srdiv { border-top: 1px solid var(--border-sec); margin: 8px 0; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.fgrid .full { grid-column: 1 / -1; }
.fld .l { font-size: 11px; font-weight: 550; color: var(--text-sub); margin-bottom: 3px; }
.fld .v { font-size: 12.5px; min-height: 17px; word-break: break-word; }
.fld .v.mut { color: var(--text-sub); }
.fld input, .fld select, .fld textarea {
  width: 100%; border: 1px solid var(--border-input); border-radius: var(--radius-btn);
  padding: 5px 9px; font-size: 12.5px; background: #fff;
  /* iOS paints native controls pure black unless told otherwise */
  color: var(--text); -webkit-text-fill-color: var(--text);
}
.fld textarea { min-height: 54px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--border-input); }

.moneywrap { display: flex; align-items: center; gap: 6px; }
.moneywrap span { color: var(--text-sub); }
.moneywrap input { flex: 1; }

/* status control chips inside the drawer — one line, swipe for more */
.status-row {
  display: flex; gap: 5px; flex-wrap: nowrap;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; min-width: 0; padding-bottom: 1px;
  mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
}
.status-row::-webkit-scrollbar { display: none; }
.status-row .chip { flex: 0 0 auto; }
.status-row .chip.on.requested { background: #998a00; color: #fff; }
.status-row .chip.on.confirmed { background: #0c5132; color: #fff; }
.status-row .chip.on.waitlist  { background: #00527c; color: #fff; }
.status-row .chip.on.declined  { background: #8e1f0b; color: #fff; }
.status-row .chip.on.cancelled { background: #616161; color: #fff; }

/* linked records */
.link-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--border-sec); cursor: pointer; font-size: 12.5px;
}
.link-row:last-child { border-bottom: 0; }
.link-row:hover { background: var(--surface-hover); }
.link-row .t { font-weight: 550; }
.link-row .s { color: var(--text-sub); font-size: 11.5px; }
.link-row .pill { margin-left: auto; }

/* notes */
.note {
  border-left: 3px solid #d4d4d4; padding: 4px 10px; margin: 0 12px 8px;
  font-size: 12.5px;
}
.note .m { color: var(--text-sub); font-size: 10.5px; margin-top: 1px; }
.note-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-sec); background: var(--surface-sec); border-radius: 0 0 var(--radius-card) var(--radius-card); }
.note-compose textarea {
  flex: 1; border: 1px solid var(--border-input); border-radius: var(--radius-btn);
  padding: 6px 9px; font-size: 12.5px; min-height: 34px; resize: vertical;
  color: var(--text); -webkit-text-fill-color: var(--text);
}

.danger-zone { padding: 4px 2px 12px; }

/* attachments */
.attach-btn { position: relative; overflow: hidden; }
.athumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px; padding: 10px 12px;
}
.athumb { position: relative; cursor: zoom-in; }
.athumb img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border-radius: var(--radius-btn); border: 1px solid var(--border); display: block;
}
.athumb .adel {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--frame); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.athumb .adel svg { width: 9px; height: 9px; }
.arow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-top: 1px solid var(--border-sec); font-size: 12.5px;
}
.arow .aic { flex: 0 0 auto; }
.arow .an { font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .as { color: var(--text-sub); font-size: 11px; flex: 0 0 auto; margin-left: auto; }

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(20,20,20,.82);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 20px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: var(--shadow-lg); }

/* sticky contextual save bar — Polaris pattern, already black */
.savebar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--frame); color: #fff; font-size: 12.5px; font-weight: 550;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(0,0,0,.18);
}
.savebar .spacer { flex: 1; }
.savebar .btn { box-shadow: none; }
.savebar-discard { background: transparent; color: #d5d8da; border-color: #454545; }
.savebar-discard:hover { background: #303030; color: #fff; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--frame); color: #fff; font-size: 12.5px; font-weight: 550;
  border-radius: var(--radius-btn); padding: 9px 16px; box-shadow: var(--shadow-lg); z-index: 200;
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------------- mobile ---------------- */
.cards-mobile { display: none; }
@media (max-width: 760px) {
  .sidebar { display: none; }
  .tabs { display: flex; }
  .content { padding: 12px 12px 70px; }
  .page-head h1 { font-size: 15px; }
  .dash-cols { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat .v { font-size: 19px; }

  /* tables become row-cards */
  .tablewrap { display: none; }
  .cards-mobile { display: block; border-top: 0; }
  .mrow {
    display: flex; flex-direction: column; gap: 2px;
    padding: 9px 12px; border-bottom: 1px solid var(--border-sec); cursor: pointer;
    background: var(--surface);
  }
  .mrow:first-child { border-radius: var(--radius-card) var(--radius-card) 0 0; }
  .mrow:last-child { border-radius: 0 0 var(--radius-card) var(--radius-card); border-bottom: 0; }
  .mrow:only-child { border-radius: var(--radius-card); }
  .mrow .r1 { display: flex; align-items: center; gap: 8px; }
  .mrow .r1 .t { font-weight: 600; font-size: 13px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* wrap to two lines before truncating — machine lists are the content */
  .mrow .r2 {
    color: var(--text-sub); font-size: 11.5px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .mrow .r3 { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
  .cards-mobile .empty { background: var(--surface); border-radius: 0 0 var(--radius-card) var(--radius-card); }

  .drawer { width: 100vw; }

  /* maximum-scale=1 in the viewport stops iOS zoom-on-focus, so inputs can
     stay near the base size instead of jumping to 16px */
  .fld input, .fld select, .fld textarea, .search input, .note-compose textarea { font-size: 14px; }
  .fld .l { font-size: 11.5px; }
  .chip { min-height: 30px; display: inline-flex; align-items: center; padding: 3px 12px; }
  .btn { min-height: 32px; }
  .sec-card .h .btn, .panel-h .btn { min-height: 26px; }
  .selcell { display: none; } /* selection is a desktop workflow */
}
@media (max-width: 480px) {
  .fgrid { grid-template-columns: 1fr; }
}
