/* CodeSmith Tools admin. Same tokens, fonts and brand as the public site (Source/Consumer/Lib/Styles/site.css),
   tuned for a dense internal tool: smaller type, full-width tables, compact forms.
   Styles the class names the WebForms and MVC pages already use (.page, .form-group, .form-item, .gridview, ...). */
:root {
  --brand: #f4811e;
  --brand-600: #e06c0a;
  --brand-700: #b85507;
  --brand-text: #b45309;
  --brand-50: #fff6ee;
  --brand-100: #ffe8d4;

  --ink: #0b1220;
  --ink-2: #1e293b;
  --muted: #5b6475;
  --line: #e6e8ee;
  --line-2: #eef0f4;
  --bg: #ffffff;
  --bg-soft: #f5f6f9;

  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --bad: #b42318;
  --bad-bg: #fef3f2;
  --info: #175cd3;
  --info-bg: #eff8ff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow: 0 12px 32px -12px rgba(16, 24, 40, .25), 0 2px 6px rgba(16, 24, 40, .06);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink-2);
  background: var(--bg-soft); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }
img { max-width: 100%; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; margin: 0 0 16px; }
h2 { font-size: 16px; font-weight: 650; margin: 24px 0 10px; }
h3 { font-size: 14px; font-weight: 650; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar);
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-inner { height: 100%; display: flex; align-items: center; gap: 22px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand:hover { text-decoration: none; }
.brand img { height: 22px; width: auto; display: block; }
.brand-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-text); background: var(--brand-50); border: 1px solid var(--brand-100);
  padding: 2px 7px; border-radius: 999px;
}
.mainnav { display: flex; align-self: stretch; }
.mainnav > ul { display: flex; align-items: stretch; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mainnav > ul > li { position: relative; display: flex; align-items: center; }
.mainnav > ul > li > a, .mainnav > ul > li > button {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 550; color: var(--ink-2); background: none; border: 0; box-shadow: none; cursor: pointer;
}
.mainnav > ul > li > a:hover, .mainnav > ul > li > button:hover,
.mainnav > ul > li > button[aria-expanded="true"] { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.mainnav > ul > li.active > a, .mainnav > ul > li.active > button { color: var(--brand-text); }
.mainnav > ul > li.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px;
}
.mainnav .caret { width: 10px; height: 10px; opacity: .6; transition: transform .15s; }
.mainnav button[aria-expanded="true"] .caret { transform: rotate(180deg); }
.mainnav .menu {
  display: none; position: absolute; top: calc(50% + 18px + 4px); left: 0; z-index: 1; min-width: 210px; margin: 0; padding: 6px;
  list-style: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mainnav li.open > .menu { display: block; }
.mainnav .menu a { display: block; padding: 7px 10px; border-radius: 6px; color: var(--ink-2); white-space: nowrap; }
.mainnav .menu a:hover, .mainnav .menu a:focus-visible { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.mainnav .menu a[aria-current="page"] { color: var(--brand-text); background: var(--brand-50); font-weight: 600; }

.topsearch { margin-left: auto; position: relative; display: flex; align-items: center; }
.topsearch svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topsearch input[type="search"] { width: 300px; height: 36px; padding-left: 34px; background: var(--bg-soft); }
.topsearch input[type="search"]:focus { background: #fff; }
.account { display: flex; align-items: center; gap: 12px; flex: none; font-size: 13px; }
.account .who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .who:hover { color: var(--ink); }
.nav-toggle { display: none; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 24px 20px 48px; max-width: 1680px; margin: 0 auto; }
.shell.has-aside { grid-template-columns: minmax(0, 1fr) 340px; }
.shell-aside { min-width: 0; }
.shell-aside > :first-child { margin-top: 0; }
.shell-aside:not(:has(*)) { display: none; }
.shell-aside .panel, .shell-aside > div > [id] { position: sticky; top: calc(var(--topbar) + 24px); }
.dialog-body { padding: 16px; background: #fff; }

/* Page card: the old ".page" box with an h1 bar */
.page, .card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px 22px 22px; margin: 0 0 20px; min-width: 0;
}
.page > h1:first-child, .page-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  margin: -20px -22px 18px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); font-size: 18px;
}
.page-head h1 { margin: 0; font-size: 18px; }
.page-head .actions { margin-left: auto; }
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 18px; }
.page-title h1 { margin: 0; }
.page-title .actions { margin-left: auto; }
.lead { color: var(--muted); margin-top: -8px; }
.muted { color: var(--muted); }
.page-links { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.page-links li { display: inline-flex; }

/* ---------- Form sections ---------- */
.form { border: 0; min-width: 0; }
.form .form-group, .form-group {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; margin: 0 0 16px; padding: 0 16px 14px;
}
.form-group > h2, .form .form-group h2 {
  margin: 0 -16px 12px; padding: 10px 16px; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--bg-soft); border-bottom: 1px solid var(--line-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.form-group > h2:empty { display: none; }
.form-group > h2 a { text-transform: none; letter-spacing: 0; margin-left: 10px; }
.form fieldset, .form-group fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-item-row { display: flex; flex-wrap: wrap; gap: 4px 16px; clear: both; }
.form-item { padding: 4px 0 6px; min-width: 0; float: none; }
.form-item > label, .form .form-item label, .field > label, label.block {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 4px;
}
.form-item label.inline, label.inline, .form-item input[type="checkbox"] + label, .form-item input[type="radio"] + label {
  display: inline; font-size: 14px; font-weight: 450; color: var(--ink-2); margin: 0 12px 0 4px;
}
.form-item > span:not([class]), .form-item > a { display: inline-block; padding: 7px 0; }
.form-column { min-width: 250px; }
.inline-form { padding: 12px 14px 6px; margin: 0 0 12px; background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.form-item-button { align-self: flex-end; padding-bottom: 6px; }
.form-group > div > .buttons:first-child, .form-group > .buttons { padding-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.form-grid > .form-group { margin: 0; }
.buttons, .submitButton { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0 14px; clear: both; text-align: left; }
.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 0 0 16px; }
.filter .form-item-row { gap: 10px 14px; }
.required, .req { color: var(--bad); }

/* ---------- Controls ---------- */
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="url"], input:not([type]), select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid #d0d5dd; border-radius: var(--radius-sm);
  height: 36px; padding: 6px 10px; max-width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 90px; line-height: 1.5; }
select { padding-right: 30px; appearance: none; -webkit-appearance: none; background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235b6475' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
select[multiple], select[size] { height: auto; background-image: none; padding-right: 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244, 129, 30, .18); }
input[readonly], input[disabled], select[disabled], textarea[disabled], textarea[readonly] { background: var(--bg-soft); color: var(--muted); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand-600); vertical-align: -3px; margin: 0 2px 0 0; }
.formtextbox, .form-textbox, input.textEntry, input.passwordEntry { width: 320px; }
.quantity-textbox { width: 64px; text-align: right; }
.date-box { width: 130px; }
.full { width: 100%; }

/* Buttons: <input type=submit|button>, <button>, and links/link buttons with .btn */
:where(input[type="submit"], input[type="button"], input[type="reset"], button, .btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  color: var(--ink-2); background: #fff; border: 1px solid #d0d5dd; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  text-decoration: none; transition: background .15s, border-color .15s;
}
:where(input[type="submit"], input[type="button"], button, .btn):hover {
  background: var(--bg-soft); color: var(--ink); text-decoration: none;
}
/* Primary: the brand orange used on the public site (white text, as on the site) */
.btn-primary, input.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn-primary:hover, input.btn-primary:hover {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.btn-danger { color: var(--bad); border-color: #fda29b; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-sm, .gridview input[type="submit"], .gridview input[type="button"], button.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
button.linklike { font: inherit; color: var(--brand-text); background: none; border: 0; padding: 0; cursor: pointer; }
button.linklike:hover { text-decoration: underline; }
input[type="image"] { vertical-align: middle; }

/* Action bars: rows of links and link buttons rendered as buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions > a, .actions > span > a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid #d0d5dd; box-shadow: var(--shadow-sm);
}
.actions > a:hover, .actions > span > a:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.actions > a.danger { color: var(--bad); border-color: #fda29b; }
.actions > a.danger:hover { background: var(--bad-bg); }
.actions > a.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.actions > a.primary:hover { background: var(--brand-600); }
.actions details { position: relative; }
.actions summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; border: 1px dashed #d0d5dd; border-radius: var(--radius-sm); color: var(--muted);
}
.actions summary::-webkit-details-marker { display: none; }
.actions details[open] summary { color: var(--ink); background: var(--bg-soft); }
.actions details .menu-pop {
  position: absolute; z-index: 20; top: 38px; left: 0; display: grid; gap: 2px; min-width: 200px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.actions details .menu-pop a { padding: 6px 10px; border-radius: 6px; color: var(--ink-2); white-space: nowrap; }
.actions details .menu-pop a:hover { background: var(--bg-soft); text-decoration: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.table-wrap > table { margin: 0; border: 0 !important; }
.gridview, table.detailstable, table.data, .page table.list, table.results1, table.results2 {
  width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; background: #fff;
  border: 1px solid var(--line) !important; border-radius: var(--radius-sm); margin: 0 0 16px;
}
.table-wrap > .gridview, .table-wrap > table { min-width: 100%; }
.gridview th, table.data th, table.detailstable th, table.list th, table.results1 th, table.results2 th {
  position: sticky; top: var(--topbar); z-index: 1;
  text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  background: var(--bg-soft) !important; padding: 9px 12px; border: 0 !important; border-bottom: 1px solid var(--line) !important; white-space: nowrap;
}
.table-wrap th { position: static; }
.gridview th a, table.data th a { color: var(--muted); }
.gridview th a:hover { color: var(--ink); }
.gridview td, table.data td, table.detailstable td, table.list td, table.results1 td, table.results2 td {
  padding: 8px 12px; border: 0 !important; border-bottom: 1px solid var(--line-2) !important; vertical-align: top; background: transparent;
}
.gridview tr:last-child td, table.data tr:last-child td { border-bottom: 0 !important; }
.gridview tr.grid-odd-row, .gridview tr:nth-child(even):not(.pager) { background: #fcfcfd !important; }
.gridview tr:not(.pager):hover > td { background: var(--brand-50); }
.gridview td a, table.data td a { font-weight: 500; }
.gridview td.num, .gridview th.num, table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.detailstable td:first-child { font-weight: 600; color: var(--muted); white-space: nowrap; width: 1%; }
/* Pager row (DynamicData/Content/GridViewPager.ascx, used by every list) */
.gridview tr:has(> td > .pager-bar) > td, .gridview tr:has(> td > .pager-bar):hover > td { background: var(--bg-soft) !important; padding: 8px 12px; border-top: 1px solid var(--line) !important; }
.pager-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; font-size: 13px; color: var(--muted); }
.pager-nav, .pager-size { display: inline-flex; align-items: center; gap: 6px; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px;
  border: 1px solid #d0d5dd; background: #fff; color: var(--ink-2); font-size: 16px; line-height: 1;
}
.pager-btn:hover { background: var(--bg); border-color: var(--brand); text-decoration: none; color: var(--ink); }
a.pager-btn[disabled], a.pager-btn.aspNetDisabled { opacity: .4; pointer-events: none; }
.pager-page { width: 56px !important; height: 30px !important; text-align: center; padding: 4px !important; }
.pager-size select { height: 30px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gridview .pager table, .gridview tr.pager table { border: 0; margin: 0; }
.gridview tr.pager table td { border: 0 !important; padding: 0 2px; }
.gridview tr.pager td a, .gridview tr.pager td span { display: inline-flex; min-width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; }
.gridview tr.pager td span { background: var(--brand); color: #fff; font-weight: 600; }
.count { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.count strong, .count b { color: var(--ink); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Status pills (rendered by the order lists) */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }

/* ---------- Messages ---------- */
.failureNotification, .error, .alert-error, span.error {
  color: var(--bad); font-weight: 500;
}
.alert { display: block; padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; border: 1px solid; font-weight: 500; }
.alert:empty, .alert-error:empty, .alert-ok:empty { display: none !important; }
.alert-error, div.error:not(:empty), .validation-summary-errors { background: var(--bad-bg); border: 1px solid #fecdca; color: var(--bad); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; display: block; }
.alert-ok, .info:not(:empty):not(.pill) { background: var(--ok-bg); border: 1px solid #abefc6; color: var(--ok); padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; display: block; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.field-validation-error, .input-validation-error + .field-validation-error { color: var(--bad); font-size: 12.5px; }
.input-validation-error { border-color: var(--bad) !important; }

/* ---------- Notes (order sidebar) ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; }
.panel > h2 { margin: 0 0 12px; font-size: 15px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.panel-head h2 { margin: 0; font-size: 15px; }
#order-note-history:empty::before { content: "No notes yet."; color: var(--muted); }
.note-entry { padding: 10px 0; border-top: 1px solid var(--line-2); }
.note-entry:first-child { border-top: 0; padding-top: 0; }
.note-by { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note-date { white-space: nowrap; }
.note-entry p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.system-generated-note { color: var(--muted); }

/* ---------- Home ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 24px; }
.tile {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--ink-2); transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--brand); text-decoration: none; color: var(--ink); transform: translateY(-1px); }
.tile strong { font-size: 15px; color: var(--ink); }
.tile span { color: var(--muted); font-size: 13px; }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.login-card .brand { justify-content: center; margin-bottom: 22px; }
.login-card .brand img { height: 26px; }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 18px; }
.login-card .field { margin-bottom: 14px; }
.login-card input[type="text"], .login-card input[type="email"], .login-card input[type="password"] { width: 100%; height: 40px; }
.login-card .remember { display: flex; align-items: center; gap: 6px; margin: 4px 0 18px; }
.login-card .remember label { font-size: 14px; font-weight: 450; color: var(--ink-2); margin: 0; }
.login-card input[type="submit"] { width: 100%; height: 40px; }

/* ---------- Dialog (replaces Ext.Window / Ext.MessageBox) ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  color: var(--ink-2);
}
dialog.modal.wide { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(11, 18, 32, .45); }
dialog.modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
dialog.modal .modal-head h2 { margin: 0; font-size: 16px; }
dialog.modal .modal-body { padding: 16px 18px; }
dialog.modal .modal-body textarea { width: 100%; min-height: 140px; }
dialog.modal .modal-body iframe { display: block; width: 100%; height: min(560px, calc(100vh - 200px)); border: 0; }
dialog.modal .modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--bg-soft); }
dialog.modal .close { width: 32px; height: 32px; padding: 0; box-shadow: none; border-color: transparent; font-size: 20px; color: var(--muted); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; box-shadow: var(--shadow); font-weight: 500; opacity: 0; transform: translateY(8px); transition: .2s;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Error pages ---------- */
.error-page { max-width: 640px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .shell.has-aside { grid-template-columns: minmax(0, 1fr); }
  .shell-aside .panel { position: static; }
  .topsearch input[type="search"] { width: 200px; }
}
@media (max-width: 860px) {
  .topbar-inner { gap: 12px; padding: 0 14px; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-left: auto;
    background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-2);
  }
  .mainnav, .topsearch, .account { display: none; }
  .topbar.nav-open { height: auto; }
  .topbar.nav-open .topbar-inner { flex-wrap: wrap; padding-bottom: 14px; }
  .topbar.nav-open .mainnav, .topbar.nav-open .topsearch, .topbar.nav-open .account { display: flex; width: 100%; }
  .topbar.nav-open .topbar-inner > .brand { height: var(--topbar); }
  .topbar.nav-open .mainnav > ul { flex-direction: column; width: 100%; }
  .topbar.nav-open .mainnav > ul > li { display: block; }
  .topbar.nav-open .mainnav > ul > li.active::after { display: none; }
  .topbar.nav-open .mainnav .menu { position: static; display: block; box-shadow: none; border: 0; padding: 0 0 6px 12px; min-width: 0; }
  .topbar.nav-open .mainnav .caret { display: none; }
  .topbar.nav-open .mainnav > ul > li > button { pointer-events: none; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; height: 30px; }
  .topbar.nav-open .topsearch { margin: 6px 0 0; }
  .topbar.nav-open .topsearch input[type="search"] { width: 100%; }
  .topbar.nav-open .account { justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line-2); }
  .shell { padding: 16px 12px 40px; gap: 14px; }
  .page, .card { padding: 16px; border-radius: 10px; }
  .page > h1:first-child, .page-head { margin: -16px -16px 14px; padding: 14px 16px; }
  .formtextbox, .form-textbox, input.textEntry, input.passwordEntry,
  .form-item input[type="text"], .form-item select, .form-item textarea { width: 100% !important; max-width: 100%; }
  .form-item { flex: 1 1 100%; }
  .gridview, table.data { display: block; overflow-x: auto; }
  .gridview th { position: static; }
}

@media print {
  .topbar, .shell-aside, .buttons, .actions, .pager { display: none !important; }
  body { background: #fff; }
  .shell { display: block; padding: 0; }
  .page { border: 0; box-shadow: none; padding: 0; }
}

/* ---------- Page-specific helpers ---------- */
/* Validators render style="color:Red"; use the palette red instead */
span[id$="Validator"], span[id*="Validator_"], .validator { color: var(--bad) !important; font-size: 12.5px; font-weight: 500; }
.form-item label span[id$="Validator"] { margin-left: 6px; }
.label-link { font-weight: 500; margin-left: 8px; font-size: 12.5px; }

/* RadioButtonList (RepeatLayout=Flow) as a segmented control */
.choice-row { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 18px; }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.segmented input:checked + label { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 1px; }
.segmented br { display: none; }

.product-list .form-item { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.product-list .form-item label.inline { margin: 0; }
.create-order .form-group .form-item input[type="text"], .create-order .form-group .form-item input[type="email"],
.create-order .form-group .form-item select { width: 100%; }
.create-order .form-group .form-item { flex: 1 1 100%; }
.create-order .product-list .quantity-textbox { width: 72px !important; flex: none; }

/* Home */
.home-search { padding: 18px 20px; }
.home-search-row { display: flex; gap: 8px; }
.home-search-row input { flex: 1; height: 40px; }
.home-search-row button { height: 40px; }
.shell-main > h2 { margin: 26px 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Links row under a page title: rendered as small buttons */
.page-links a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid #d0d5dd; box-shadow: var(--shadow-sm); }
.page-links a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.check { display: inline-flex; align-items: center; gap: 6px; height: 36px; }
.check label, .filter .check label { margin: 0 !important; font-size: 14px; font-weight: 450; color: var(--ink-2); }
.filter > input[type="submit"], .filter > span > input[type="submit"] { margin-bottom: 6px; }
.filter .check { margin-bottom: 6px; }

/* List tables: one line per cell; wide tables scroll sideways (admin.js wraps them) */
.gridview td { white-space: nowrap; }
.gridview td.wrap, .gridview td .wrap { white-space: normal; }

/* Filters above lists */
.filter-panel { margin: 0 0 18px; padding: 14px 16px 6px; background: var(--bg-soft); border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.filter-panel .filter { margin: 0 0 8px; }
.filter-search { flex: 1 1 360px; }
.filter-search input { width: 100%; }
.filter-input { width: 140px; }
.filter .form-item { padding: 0; }
.filter > input[type="submit"] { margin-bottom: 0; }
.filter .check { margin-bottom: 0; }
.simple-pager { padding: 4px 0; }
.page-head .actions > a { height: 32px; }
.page.narrow { max-width: 820px; }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
textarea.mono { font-family: var(--mono); font-size: 13px; }

@media print { .page-title .actions { display: none; } }

/* ---------- Editors (content, email templates) ---------- */
.back-link { display: inline-block; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.back-link::before { content: "\2190  "; }
.mono-title { font-family: var(--mono); font-size: 18px; font-weight: 600; word-break: break-all; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.editor-layout > .card { margin: 0; }
.code-editor { width: 100%; min-height: 420px; font-family: var(--mono); font-size: 13px; line-height: 1.55; tab-size: 4; white-space: pre; resize: vertical; }
.form-item.grow { flex: 1 1 320px; }
fieldset[disabled] .code-editor, fieldset[disabled] input, fieldset[disabled] select { background: var(--bg-soft); color: var(--ink-2); }
.alert-info { display: block; background: var(--info-bg); border: 1px solid #b2ddff; color: #1849a9; padding: 10px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; }
.inline-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; }
.history { position: sticky; top: calc(var(--topbar) + 20px); max-height: calc(100vh - var(--topbar) - 40px); overflow: auto; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
.history-list li.current { background: var(--brand-50); }
.history-list li .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrow-card { max-width: 900px; }
.card.empty { padding: 28px; }
@media (max-width: 1100px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } .history { position: static; max-height: none; } }

/* Inputs with a unit, danger zone */
.input-prefix, .input-suffix { display: inline-flex; align-items: center; }
.input-prefix > span, .input-suffix > span { display: inline-flex; align-items: center; height: 36px; padding: 0 10px; background: var(--bg-soft); border: 1px solid #d0d5dd; color: var(--muted); font-size: 13px; }
.input-prefix > span { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-prefix > input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-suffix > span { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-suffix > input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.form-group .segmented { margin: 2px 0 10px; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding: 14px 16px; border: 1px solid #fecdca; border-radius: var(--radius-sm); background: #fffbfa; }
.danger-zone .hint { margin: 2px 0 0; }
[hidden] { display: none !important; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 6px; }
.facts dt { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.facts dd { margin: 2px 0 0; font-weight: 500; color: var(--ink); }
.shell-main .page > h2 { margin-top: 26px; }
table.tiers { width: auto; min-width: 0; }
.validation-summary-valid { display: none !important; }

/* ---------- Dashboard and reports ---------- */
/* Categorical slots validated for this surface (dataviz validator, light, #ffffff): blue, orange, aqua, yellow */
:root { --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --chart-grid: #eceae4; --chart-axis: #c3c2b7; --chart-ink: #6b6a66; }
.stats { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 14px; margin: 0 0 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin: 4px 0 2px; }
.stat.hero .stat-value { font-size: 48px; line-height: 1.05; }
.stat-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.delta { font-size: 12.5px; font-weight: 600; }
.delta.up { color: #067647; }
.delta.down { color: #b42318; }
.delta.flat { color: var(--muted); }
.delta .muted { font-weight: 450; }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.card-head h2, .card > h2 { margin: 0; font-size: 15px; }
.card > h2 { margin-bottom: 10px; }
.small { font-size: 12.5px; }
.mini-title { margin: 12px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); }

.dash-search { display: flex; gap: 8px; margin-left: auto; width: min(520px, 100%); }
.dash-search input { flex: 1; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; margin-bottom: 20px; }
.dash-grid > .card, .dash-side > .card { margin: 0; }
.dash-side { display: grid; gap: 20px; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; margin-bottom: 20px; }
.report-grid > .card { margin: 0; }
.title-range { font-size: 15px; font-weight: 500; margin-left: 6px; }

.todo { list-style: none; margin: 0; padding: 0; }
.todo li + li { border-top: 1px solid var(--line-2); }
.todo a { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: var(--ink-2); }
.todo a:hover { text-decoration: none; background: var(--bg-soft); }
.todo-count { flex: none; min-width: 34px; height: 28px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--brand-50); color: var(--brand-text); font-weight: 700; }
.todo-count.zero { background: var(--bg-soft); color: var(--muted); }
.todo-text { display: flex; flex-direction: column; font-weight: 550; }
.todo-text .muted { font-size: 12.5px; font-weight: 450; }

/* SVG charts (Classes/Analytics/Charts.cs) */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--chart-ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .s1, .key.s1, .hbar-fill { fill: var(--series-1); background: var(--series-1); }
.chart .s2, .key.s2 { fill: var(--series-2); background: var(--series-2); }
.chart .s3, .key.s3 { fill: var(--series-3); background: var(--series-3); }
.chart .s4, .key.s4 { fill: var(--series-4); background: var(--series-4); }
.chart .hit { fill: transparent; cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: rgba(11, 18, 32, .05); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.data-table { margin-top: 12px; }
.data-table summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand-text); }
.data-table table { margin-top: 10px; }

.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; outline: none; }
.hbar:focus-visible { box-shadow: 0 0 0 2px var(--brand); border-radius: 4px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar-track { height: 14px; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-value { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; min-width: 70px; text-align: right; }

.chart-tip { position: fixed; z-index: 300; pointer-events: none; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow); white-space: pre-line; }
.chart-tip strong { display: block; margin-bottom: 2px; }

.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 18px; }
.range-presets { display: inline-flex; flex-wrap: wrap; padding: 3px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.range-presets a { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.range-presets a:hover { color: var(--ink); text-decoration: none; background: var(--bg-soft); }
.range-presets a[aria-current] { background: var(--brand-50); color: var(--brand-text); }
.range-custom { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.range-custom input[type="date"] { width: 150px; height: 32px; }
.range-custom select { height: 32px; }
.csv-link { margin-left: auto; font-size: 13px; font-weight: 600; }
.mix { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 40px; }
.mix dl { margin: 0; display: grid; gap: 6px; }
.mix dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.mix dt { color: var(--muted); }
.mix dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.gridview tfoot th { position: static; background: var(--bg-soft) !important; color: var(--ink); text-transform: none; font-size: 13.5px; letter-spacing: 0; border-top: 1px solid var(--line) !important; }

@media (max-width: 1200px) { .stats { grid-template-columns: repeat(2, 1fr); } .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .stats { grid-template-columns: 1fr; } .stat.hero .stat-value { font-size: 40px; } .mix { grid-template-columns: 1fr; } .report-grid { grid-template-columns: minmax(0, 1fr); } .dash-search { width: 100%; } .csv-link { margin-left: 0; } }
table.data th, table.detailstable th { position: static; }
.latest-orders { margin-bottom: 20px; }

/* Sections with more than one header (the Order page's Workflow and Actions): room under each button row, and
   later headers span the card with a divider instead of floating rounded corners. */
.form-group > .actions { padding: 2px 0 16px; }
.form-group > .actions:last-child { padding-bottom: 2px; }
.form .form-group > h2 ~ h2, .form-group > h2 ~ h2 { margin-top: 0; border-radius: 0; border-top: 1px solid var(--line-2); }


/* ---------- Phones: touch-sized controls, stacked forms, list tables as cards ---------- */
.filter-toggle { display: none; }
@media (max-width: 860px) {
  /* 16px text keeps iOS from zooming into a field on focus (and overrides inline font-size on old fields). */
  input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"],
  input[type="date"], input[type="tel"], input[type="url"], input:not([type]), select { height: 44px; font-size: 16px !important; }
  textarea { font-size: 16px !important; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  :where(input[type="submit"], input[type="button"], input[type="reset"], button:not([class*="tox-"]), .btn), .page-links a, .actions > a, .actions > span > a { height: 44px; padding: 0 16px; font-size: 15px; }
  .form-item input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not(.quantity-textbox), .form-item select, .form-item textarea { width: 100% !important; }
  /* A button that follows a field (Find, Unlock, Check History...) sits below it, not against it. */
  .form-item > :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) ~ :is(input[type="submit"], input[type="button"], button, .btn) { margin-top: 10px; }
  .buttons, .actions { gap: 10px; }
  .filter-toggle { display: inline-flex; }
  .filter-panel:not(.show-more) > .filter:not(.filter-main) { display: none; }
  .filter-main { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  table.stack { display: block; overflow: visible; border: 0; background: none; }
  table.stack tbody, table.stack tfoot { display: block; }
  table.stack thead, table.stack tr.stack-head { display: none; }
  table.stack tr { display: block; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; }
  table.stack tr:hover { background: #fff; }
  table.stack tr.stack-full { padding: 8px 0; border: 0; background: none; }
  table.stack :is(td, th) { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 4px 0; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; min-height: 0; }
  table.stack :is(td, th)::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; }
  table.stack :is(td, th)[data-label=""] { justify-content: flex-start; text-align: left; }
  table.stack :is(td, th)[data-label=""]::before { content: none; }
  table.stack :is(td, th):empty, table.stack :is(td, th).stack-empty { display: none; }
  table.stack :is(td, th):first-child { font-size: 15px; font-weight: 600; }
  table.stack :is(td, th) a { padding: 4px 0; }
  table.stack tr.stack-full td { display: block; text-align: left; }
  table.stack tr.stack-full td::before { content: none; }
  .table-wrap:has(> table.stack) { overflow: visible; border: 0; }
}
@media (max-width: 860px) {
  .btn-sm, button.btn-sm, .gridview input[type="submit"], .gridview input[type="button"] { height: 44px; padding: 0 14px; font-size: 14px; }
  .pager-btn { width: 44px; height: 44px; }
  .pager-page { width: 64px !important; height: 44px !important; }
  .pager-size select { height: 44px; }
  .range-presets a { padding: 10px 12px; }
  .range-custom { width: 100%; }
  .range-custom input[type="date"] { flex: 1 1 140px; width: auto; height: 44px; }
  .range-custom select, .range-custom button, .range-custom input[type="submit"] { height: 44px; }
}
@media (max-width: 860px) { .page-head .actions > a { height: 44px; } .page-head { flex-wrap: wrap; gap: 10px; } }
/* The menu button is a fixed square: the phone button padding above would squeeze its icon to a sliver. */
@media (max-width: 860px) { .nav-toggle { width: 44px; height: 44px; padding: 0; } .nav-toggle svg { width: 22px; height: 22px; flex: none; } }
/* The menu button shows three lines, and an X while the menu is open. */
.nav-toggle .i-close, .topbar.nav-open .nav-toggle .i-menu { display: none; }
.topbar.nav-open .nav-toggle .i-close { display: inline; }
