:root {
  color-scheme: dark;
  --window: #202020;
  --sidebar: #202020;
  --surface: #323232;
  --surface-alt: #272727;
  --surface-hover: #353535;
  --surface-pressed: #292929;
  --surface-selected: #383838;
  --border: #4a4a4a;
  --border-soft: #3a3a3a;
  --border-focus: #9f9f9f;
  --disabled: #242424;
  --disabled-border: #303030;
  --text: #f3f3f3;
  --muted: #d6d6d6;
  --subtle: #7a7a7a;
  --white: #ffffff;
  --scrollbar: #3c3c3c;
  --valid: #77d49b;
  --invalid: #ff9d9d;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--window);
  color: var(--text);
  font: 14px/1.35 "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--window); }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 6px; border: 3px solid var(--window); }
[hidden] { display: none !important; }

/* Shell */
.shell { display: flex; height: 100vh; min-width: 0; }
.sidebar {
  width: 206px; flex: none; padding: 26px 12px 20px 12px;
  background: var(--sidebar); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.login-button {
  min-height: 42px; margin-bottom: 18px; border-radius: 6px; font-weight: 600; cursor: pointer;
  background: #203128; border: 1px solid #315a40; color: var(--text);
}
.login-button:hover { border-color: #78d993; }
.nav-row { display: flex; align-items: center; gap: 4px; }
.nav-button {
  flex: 1; display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 15px;
  background: transparent; border: 0; border-radius: 7px; text-align: left; font-size: 15px; cursor: pointer;
}
.nav-button:hover { background: var(--surface-alt); }
.nav-button.active { background: var(--surface-hover); border-left: 3px solid var(--white); padding-left: 12px; font-weight: 600; }
.info-button {
  width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent;
  color: var(--muted); font: 600 12px/1 Georgia, serif; cursor: pointer; padding: 0;
}
.info-button:hover { border-color: var(--white); color: var(--white); }
.content { flex: 1; min-width: 0; display: flex; gap: 16px; padding: 18px 14px 20px 26px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.page-title { margin: 9px 0 0; font-size: 21px; font-weight: 700; }

/* Cards */
.metrics { display: flex; gap: 14px; }
.metric {
  flex: 1; min-width: 0; min-height: 104px; display: flex; align-items: center; gap: 16px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.metric svg { width: 36px; height: 36px; flex: none; }
.metric-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value { font-size: 24px; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.card {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px; overflow: hidden;
}
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 24px; }
.section-title { margin: 0; font-size: 21px; font-weight: 700; }
.tools { display: flex; gap: 10px; padding: 0 24px 14px; }

/* Controls */
.button {
  min-height: 38px; padding: 0 15px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.button:hover { background: var(--surface-hover); border-color: var(--border-focus); }
.button:active { background: var(--surface-pressed); }
.button:disabled { color: var(--subtle); background: var(--disabled); border-color: var(--disabled-border); cursor: default; }
.button.primary { background: var(--white); color: #202020; border-color: var(--white); font-weight: 600; }
.button.primary:disabled { color: var(--subtle); background: var(--disabled); border-color: var(--disabled-border); }
.button.danger { background: #b4232d; border-color: #ca3540; color: #fff; font-weight: 600; }
.button.danger:hover { background: #c92b37; border-color: #e34b56; }
.button.danger:active { background: #951c25; }
.icon-button {
  width: 38px; height: 38px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 20px;
}
.icon-button:hover { background: var(--surface-hover); }
.input, .textarea, .select {
  min-height: 40px; padding: 0 12px; border-radius: 7px; outline: none;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--border-focus); }
.textarea { padding: 10px 12px; resize: none; width: 100%; height: 110px; }
.search { position: relative; width: 410px; max-width: 100%; }
.search svg { position: absolute; left: 12px; top: 11px; width: 19px; height: 19px; }
.search .input { width: 100%; padding-left: 42px; }
.filter-button { display: inline-flex; align-items: center; gap: 8px; min-width: 112px; }
.filter-button svg { width: 18px; height: 18px; }

/* Table */
.table-wrap { flex: 1; min-height: 300px; overflow: auto; border-top: 1px solid var(--border-soft); }
table { border-collapse: collapse; table-layout: fixed; }
th {
  position: sticky; top: 0; z-index: 1; height: 38px; padding: 0 10px; font-weight: 600; text-align: center;
  background: var(--surface); border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
td {
  height: 62px; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft);
  white-space: pre; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; line-height: 20px;
}
td.center { text-align: center; }
tbody tr { cursor: default; }
tbody tr:hover td { background: var(--surface-hover); }
tbody tr.selected td { background: var(--surface-selected); }
.name-cell { display: flex; align-items: center; gap: 10px; color: #f4f4f4; }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: #3b3d40; color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 500;
}
.pill { display: inline-block; min-width: 48px; height: 26px; line-height: 24px; padding: 0 12px; border-radius: 13px; background: var(--surface-alt); border: 1px solid #d8d8d8; }
.pill.valid { color: var(--valid); }
.pill.invalid { color: var(--invalid); }

/* Footer */
.footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px 24px; border-top: 1px solid var(--border-soft); }
.footer-status { color: var(--muted); white-space: nowrap; }
.pages { display: flex; gap: 4px; }
.page-button { min-width: 38px; min-height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.page-button.current { background: var(--surface-alt); border-color: var(--border); }
.page-button:hover:not(:disabled) { background: var(--surface-selected); border-color: var(--border-focus); }
.page-button:disabled { color: var(--subtle); cursor: default; }
.page-gap { min-width: 24px; display: grid; place-items: center; color: var(--muted); }
.page-size { display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }
.page-size .select { width: 136px; color: var(--text); }

/* Drawer */
.drawer {
  width: 380px; flex: none; display: flex; flex-direction: column; overflow-y: auto; padding: 22px 24px 26px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.drawer-title { display: flex; align-items: center; justify-content: space-between; }
.subtitle { margin: 10px 0 12px; color: var(--muted); font-size: 15px; }
.trial-label { margin-bottom: 12px; white-space: pre-wrap; user-select: text; }
.field-label { display: block; font-weight: 500; color: #f0f0f0; margin-bottom: 7px; }
.field { margin-top: 24px; }
.field .input { width: 100%; }
.limits { display: flex; gap: 14px; margin-top: 24px; align-items: flex-end; }
.limits > div { flex: 1; }
.spin { display: flex; width: 145px; }
.spin .input { width: 100%; border-radius: 7px 0 0 7px; -moz-appearance: textfield; }
.spin .input::-webkit-inner-spin-button { display: none; }
.spin button { width: 30px; border: 1px solid var(--border); border-left: 0; background: var(--surface-alt); cursor: pointer; }
.spin button:last-child { border-radius: 0 7px 7px 0; }
.spin button:hover { background: var(--surface-hover); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; }
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; background: none; border: 0; padding: 0; }
.toggle-track { width: 40px; height: 20px; border-radius: 10px; border: 1px solid var(--muted); position: relative; }
.toggle-track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted);
  transition: left .12s;
}
.toggle[aria-checked="true"] .toggle-track { background: var(--white); border-color: var(--white); }
.toggle[aria-checked="true"] .toggle-track::after { left: 24px; background: #202020; }
.toggle-text { min-width: 24px; color: var(--muted); }
.end-fields { display: flex; gap: 6px; margin-top: 10px; }
.end-fields label { flex: 4; min-width: 0; font-size: 12px; color: var(--muted); }
.end-fields label.year { flex: 5; }
.end-fields .input { width: 100%; padding: 0 8px; margin-top: 4px; -moz-appearance: textfield; }
.end-fields .input::-webkit-inner-spin-button { display: none; }
.hint { margin-top: 10px; color: var(--muted); }
.note-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; margin-bottom: 7px; }
.note-heading .field-label { margin: 0; }
.drawer-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 24px; }

/* Menus and dialogs */
.menu {
  position: fixed; z-index: 20; min-width: 220px; padding: 4px; border-radius: 8px;
  background: var(--surface-alt); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus { background: var(--surface-selected); outline: none; }
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; }
.dialog {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; border-radius: 10px;
  background: var(--window); border: 1px solid var(--border);
}
.dialog.wide { width: min(850px, 100%); }
.dialog h2 { margin: 0 0 14px; font-size: 17px; }
.dialog p { margin: 0; white-space: pre-wrap; user-select: text; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dialog table { width: 100%; table-layout: auto; }
.dialog td { height: 36px; white-space: normal; }

/* Sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card {
  width: min(420px, 100%); padding: 32px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.signin-card h1 { margin: 0 0 10px; font-size: 21px; }
.signin-card p { margin: 0 0 22px; color: var(--muted); }
.signin-card .button { width: 100%; min-height: 42px; }
.signin-error { margin-top: 16px; color: var(--invalid); }

/* Shared additions for trials, Patreons and website */
.busy .content { pointer-events: none; }
.busy .content .main, .busy .content .drawer { opacity: .85; }
.info-space { width: 22px; flex: none; }
.metric-text { min-width: 0; }
.metric-label.wrap { white-space: normal; }
th { position: sticky; }
.resize-handle { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; }
.tools { align-items: center; }
.tools-space { flex: 1; }
.menu-separator { height: 1px; margin: 4px 6px; background: var(--border-soft); }
.menu-check { width: 14px; display: inline-block; }
.menu button:disabled { color: var(--subtle); cursor: default; background: transparent; }
.dialog-table { max-height: 50vh; overflow: auto; border: 1px solid var(--border-soft); border-radius: 8px; }
.dialog-table th { position: sticky; top: 0; }
.dialog tbody tr.selected td { background: var(--surface-selected); }
.dialog tbody tr { cursor: default; }
.select { cursor: pointer; }
.select.small { min-height: 34px; width: 110px; }

/* Trials */
.trial-summary { display: flex; flex-wrap: wrap; gap: 14px; }
.trial-summary .metrics { flex: 1 1 360px; }
.config-card { flex: none; display: flex; flex-direction: row; align-items: flex-end; gap: 12px; padding: 16px 22px; overflow: visible; }
.config-title { align-self: center; margin-right: 6px; }
.config-heading { font-size: 17px; font-weight: 650; }
.duration-field { display: flex; flex-direction: column; gap: 6px; }
.duration-field .spin { width: 112px; }
.pill.trial-active { background: #1e3327; border-color: #78d993; color: #78d993; }
.pill.trial-expired { background: #3d2528; border-color: #f07f89; color: #f07f89; }
.row-action { width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-size: 18px; }
.row-action:hover { background: var(--surface-hover); }

/* Patreons */
.filter-card { text-align: left; cursor: pointer; color: inherit; font: inherit; }
.filter-card:hover:not(:disabled) { background: var(--surface-hover); border-color: #777b7f; }
.filter-card.checked { background: var(--surface-selected); border-color: #b0b4b8; }
.filter-card:disabled { cursor: default; }
.levels-card { flex: none; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; overflow: visible; }
.level-strip { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.level-segment {
  flex: 1; min-height: 108px; padding: 12px 14px; border: 0; border-left: 1px solid var(--border); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; cursor: pointer;
}
.level-segment:first-child { border-left: 0; }
.level-segment .metric-label { min-height: 40px; display: flex; align-items: center; }
.level-segment:hover:not(:disabled) { background: var(--surface-hover); }
.level-segment.checked { background: var(--surface-selected); }
.level-segment:disabled { cursor: default; }
.patreon-card { padding-top: 16px; }
.patreon-tools .select { width: 200px; }
.search.grow { flex: 1; width: auto; }
.patreon-status { padding: 0 24px 12px; }

/* Website */
.page-header { display: flex; align-items: center; gap: 10px; }
.page-header .select { width: 184px; }
.tiles { display: flex; gap: 10px; }
.tile-group { flex: 3; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.tile {
  flex: 1; min-width: 0; padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
}
.tile.grouped { border: 0; border-left: 1px solid var(--border); border-radius: 0; background: transparent; }
.tile.grouped:first-child { border-left: 0; }
.tile:hover:not(:disabled) { background: var(--surface-hover); border-color: #777b7f; }
.tile.checked, .tile.grouped.checked { background: #223c2d; border-color: #62ce97; }
.tile:disabled { cursor: default; }
.tile-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { font-size: 27px; font-weight: 600; margin-top: 7px; white-space: nowrap; }
.graphics { display: flex; gap: 12px; min-height: 260px; flex: 1; }
.graphics > .card { flex: 1; min-width: 0; }
.small-card { padding: 12px 16px; gap: 7px; }
.chart-host { flex: 1; min-height: 170px; overflow-x: auto; overflow-y: hidden; }
.chart-label { fill: #a9acb0; font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 13px; }
.map-header { display: flex; align-items: center; justify-content: space-between; }
.map-host { flex: 1; min-height: 120px; overflow: hidden; }
.map-label { fill: #f4f4f4; font-size: 12px; }
.attribution { font-size: 11px; color: #a9acb0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); }
.tab { padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; color: var(--muted); }
.tab.active { color: var(--text); border-bottom-color: var(--white); font-weight: 600; }
.website-table { max-height: 260px; overflow: auto; }
table.plain { width: 100%; table-layout: auto; }
table.plain td { height: 42px; white-space: nowrap; }
table.plain th.sortable { cursor: pointer; text-align: left; }
table.plain th.sortable:hover { background: var(--surface-hover); }
table.plain .number { text-align: right; }
.website-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.refresh-button { display: inline-flex; align-items: center; gap: 8px; }
.main { min-height: 0; overflow-y: auto; }
.tiles { flex-wrap: wrap; }
.tiles > .tile { flex: 1 1 130px; }
.tile-group { flex: 3 1 440px; }
.tile.grouped { min-width: 0; }
.main > .graphics { flex: none; height: 280px; }
.main > .card.small-card { flex: none; }
.website-table { min-height: 170px; }
.signin-card .field-label { text-align: left; }
.code-input { width: 100%; margin-bottom: 14px; text-align: center; letter-spacing: 2px; font-size: 18px; text-transform: uppercase; }
.link-button { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link-button:hover { color: var(--text); }
.signin-card .signin-error { margin-top: 16px; }
.nav-button.small { flex: none; min-height: 42px; font-size: 14px; color: var(--muted); }
.enroll-code { margin-top: 18px; padding: 14px; text-align: center; font-size: 26px; letter-spacing: 3px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; user-select: all; }

/* Phones: header on top, navigation at the bottom, table rows as cards */
.mobile-header { display: none; }
.login-button.compact { min-height: 34px; margin: 0; padding: 0 12px; font-size: 13px; }
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px; } /* keeps iOS from zooming into fields */
  .shell { flex-direction: column; height: auto; min-height: 100vh; }
  .mobile-header {
    display: flex; position: sticky; top: 0; z-index: 10; align-items: center; gap: 6px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--sidebar); border-bottom: 1px solid var(--border-soft);
  }
  .mobile-title { flex: 1; font-weight: 700; font-size: 16px; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; width: auto; flex-direction: row; gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border-soft);
  }
  .sidebar > .login-button, .sidebar > .tools-space, .sidebar > .nav-button.small,
  .nav-row .info-button, .nav-row .info-space { display: none; }
  .nav-row { flex: 1; min-width: 0; }
  .nav-button { flex-direction: column; justify-content: center; gap: 3px; min-height: 52px; padding: 4px 2px; font-size: 11px; }
  .nav-button.active { border-left: 0; padding-left: 2px; }
  .content { flex-direction: column; padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .main { overflow: visible; gap: 14px; }
  .page-title { margin: 2px 0 0; font-size: 20px; }
  .metrics { flex-wrap: wrap; gap: 10px; }
  .metric { flex: 1 1 140px; min-height: 76px; padding: 12px 14px; gap: 10px; }
  .metric svg { width: 28px; height: 28px; }
  .metric-value { font-size: 20px; }
  .card { flex: none; }
  .card-header { flex-wrap: wrap; gap: 10px; padding: 14px 14px 12px; }
  .section-title { font-size: 18px; }
  .tools { flex-wrap: wrap; padding: 0 14px 12px; }
  .search, .search.grow { flex: 1 1 100%; width: 100%; }
  .tools .button, .tools .select { flex: 1 1 auto; }
  .tools-space { display: none; }
  .table-wrap { min-height: 0; overflow: visible; border-top: 0; padding: 0 12px; }
  .table-wrap table { display: block; width: 100% !important; }
  .table-wrap colgroup, .table-wrap thead { display: none; }
  .table-wrap tbody { display: flex; flex-direction: column; gap: 10px; }
  .table-wrap tr { display: block; padding: 4px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); }
  .table-wrap tr.selected { border-color: var(--border-focus); }
  .table-wrap tr.selected td, tbody tr:hover td { background: transparent; }
  .table-wrap td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; height: auto !important; padding: 7px 0;
    border: 0; border-bottom: 1px solid var(--border-soft); white-space: pre-line; text-align: right; overflow: visible;
  }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td.empty { display: none; }
  .metric-label { white-space: normal; }
  .table-wrap td::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--muted); text-align: left; }
  .table-wrap td.row-actions { justify-content: flex-end; }
  .table-wrap td.row-actions::before { display: none; }
  .name-cell { justify-content: flex-end; }
  .footer { grid-template-columns: 1fr; justify-items: center; padding: 12px; }
  .page-size { justify-content: center; }
  .drawer {
    position: fixed; inset: 0; z-index: 25; width: auto; border-radius: 0;
    padding: calc(16px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  }
  .menu { left: 12px !important; right: 12px; top: auto !important; bottom: calc(76px + env(safe-area-inset-bottom)); min-width: 0; }
  .menu button { min-height: 46px; font-size: 16px; }
  .dialog { padding: 18px 16px; }
  .trial-summary .metrics { flex: 1 1 100%; }
  .config-card { flex: 1 1 100%; flex-wrap: wrap; }
  .config-title { flex: 1 1 100%; }
  .duration-field { flex: 1 1 28%; }
  .duration-field .spin { width: 100%; }
  .config-card > .button { flex: 1 1 100%; }
  .level-strip { flex-wrap: wrap; }
  .level-segment { flex: 1 1 50%; min-height: 84px; border-left: 0; border-top: 1px solid var(--border); }
  .patreon-tools .select { flex: 1 1 100%; width: 100%; }
  .patreon-status { padding: 0 14px 10px; }
  .page-header { flex-wrap: wrap; }
  .page-header .page-title { flex: 1 1 100%; }
  .page-header .select { flex: 1 1 45%; width: auto; }
  .page-header .button { flex: 1 1 100%; }
  .tiles > .tile { flex: 1 1 45%; }
  .tile-group { flex: 1 1 100%; flex-wrap: wrap; }
  .tile.grouped { flex: 1 1 45%; border-left: 0; border-top: 1px solid var(--border); }
  .tile-value { font-size: 22px; }
  .main > .graphics { flex-direction: column; height: auto; }
  .graphics > .card { min-height: 250px; }
  .website-footer { flex-direction: column; align-items: stretch; }
}

/* Devices */
.device-card { flex: none; }
.device-hint { margin: 0; padding: 0 24px 16px; color: var(--muted); }
.device-card .table-wrap { min-height: 0; }
.pill.current-device { margin-left: 10px; color: var(--valid); border-color: var(--valid); }
@media (max-width: 760px) {
  .device-hint { padding: 0 14px 12px; }
  .pill.current-device { margin-left: 8px; }
}

/* One select look on every system, matching the manager combo boxes and the buttons beside them */
.select {
  -webkit-appearance: none; appearance: none; height: 38px; min-height: 38px; padding: 0 34px 0 12px; line-height: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23d6d6d6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
  text-overflow: ellipsis; white-space: nowrap;
}
.select:hover { border-color: var(--border-focus); }
.page-header .button { height: 38px; }

/* Mailboxes */
.mail-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px 14px; }
.mail-read { display: flex; flex-direction: column; gap: 14px; }
.mail-read h3 { margin: 4px 0 0; font-size: 15px; }
.mail-meta { display: flex; flex-direction: column; gap: 4px; user-select: text; }
.mail-body, .mail-history {
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; padding: 12px; border-radius: 8px;
  background: var(--surface-alt); border: 1px solid var(--border-soft);
}
.mail-body { max-height: 46vh; overflow: auto; }
.mail-history { max-height: 170px; overflow: auto; color: var(--muted); }
.mail-files { display: flex; flex-direction: column; gap: 6px; }
.mail-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-soft); }
.mail-file-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.mail-file-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
a.button { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.mail-reply { display: flex; flex-direction: column; gap: 10px; }
.mail-reply .input { width: 100%; }
.reply-body { height: 300px; }
@media (max-width: 760px) {
  .sidebar { overflow-x: auto; justify-content: flex-start; }
  .nav-row { flex: 0 0 76px; }
  .mail-footer { padding: 0 14px 12px; }
  .mail-file { flex-wrap: wrap; }
  .reply-body { height: 220px; }
}

/* Error reports and trash */
.report-header { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
.report-header .select { width: 180px; }
.filter-panel { width: 320px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-row .select { width: 190px; }
.filter-custom { display: flex; flex-direction: column; gap: 6px; }
.filter-custom .input { width: 100%; }
tbody tr.group-row td { font-weight: 700; cursor: pointer; background: var(--surface-alt); }
.group-toggle { display: inline-block; width: 18px; color: var(--muted); }
tbody tr.child-row td:first-child { padding-left: 32px; }
.report-text { max-height: 58vh; font-size: 13px; }
.report-attachments { display: flex; gap: 8px; }
.grow-select { flex: 1; width: auto; }
.note-form { display: flex; flex-direction: column; gap: 6px; }
.note-form .input { width: 100%; }
.note-field { height: 84px; }
.trash-card { flex: none; padding-top: 16px; }
.trash-info { padding-top: 4px; }
.trash-grid { display: flex; flex-direction: column; gap: 10px; max-width: 380px; padding: 0 24px 18px; }
.trash-row { display: flex; justify-content: space-between; gap: 24px; }
.trash-count { text-align: right; color: var(--muted); }
.trash-actions { display: flex; gap: 8px; }
.button.danger:disabled { background: #442126; border-color: #633139; color: var(--muted); }
@media (max-width: 760px) {
  .report-header .select { flex: 1 1 45%; width: auto; }
  .filter-panel { left: 12px !important; right: 12px; width: auto; top: auto !important; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .filter-row .select { width: 60%; }
  .trash-grid { padding: 0 14px 14px; }
  .trash-actions { flex-wrap: wrap; }
  tbody tr.child-row td:first-child { padding-left: 0; }
}
