/* =============================================================================
   web2py admin — visual system (zahmee build)
   Loaded after Bootstrap 2.3 and bootstrap_essentials.css; overrides both.
   One warm-tinted neutral palette, one accent (web2py orange) reserved for
   primary actions, links and current-state indicators. System font stack.
   ========================================================================== */

:root {
  --bg:            oklch(98.4% 0.006 75);
  --surface:       oklch(99.4% 0.003 75);
  --surface-2:     oklch(96.6% 0.008 75);
  --surface-3:     oklch(94% 0.01 75);
  --border:        oklch(90.5% 0.012 75);
  --border-strong: oklch(82% 0.014 75);
  --text:          oklch(25% 0.02 60);
  --text-2:        oklch(46% 0.02 60);
  --text-3:        oklch(62% 0.016 60);
  --accent:        oklch(64% 0.17 55);
  --accent-hover:  oklch(57% 0.17 52);
  --accent-soft:   oklch(95.5% 0.035 65);
  --accent-text:   oklch(48% 0.16 50);
  --danger:        oklch(54% 0.19 28);
  --danger-soft:   oklch(95.5% 0.03 28);
  --success:       oklch(52% 0.14 150);
  --success-soft:  oklch(95.5% 0.04 150);
  --warning-soft:  oklch(96% 0.05 90);
  --nav-bg:        oklch(23% 0.018 60);
  --nav-bg-2:      oklch(30% 0.02 60);
  --nav-text:      oklch(90% 0.01 75);
  --nav-text-2:    oklch(70% 0.014 75);
  --code-bg:       oklch(97% 0.008 75);
  --radius:        6px;
  --radius-sm:     4px;
  --shadow-1:      0 1px 2px oklch(20% 0.02 60 / 0.06), 0 1px 1px oklch(20% 0.02 60 / 0.04);
  --shadow-2:      0 8px 24px oklch(20% 0.02 60 / 0.12), 0 2px 6px oklch(20% 0.02 60 / 0.06);
  --font:          -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:          ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --ease:          cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h:      48px;
}

/* ---------------------------------------------------------------- base */
html { background: var(--bg); }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a, a:hover, a:focus { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1, h2, h3, h4, h5 { font-family: var(--font); color: var(--text); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 650; line-height: 1.25; }
h2 { font-size: 22px; font-weight: 650; line-height: 1.25; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.35; }
h4 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h5 { font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 10px; }
code, pre, tt, kbd, .mono { font-family: var(--mono); font-size: 12.5px; }
code { padding: 1px 5px; border-radius: var(--radius-sm); background: var(--code-bg); border: 1px solid var(--border); color: var(--text); }
pre {
  padding: 12px 14px;
  margin: 0 0 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  line-height: 1.5;
  overflow: auto;
}
pre code { padding: 0; border: 0; background: transparent; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
img { vertical-align: middle; }
small, .small { font-size: 12px; color: var(--text-2); }
b, strong { font-weight: 600; }

/* ---------------------------------------------------------------- top bar */
.adm-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  height: var(--topbar-h);
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  box-shadow: 0 1px 0 oklch(0% 0 0 / 0.25);
}
.adm-top a { color: var(--nav-text-2); text-decoration: none; }
.adm-top a:hover { color: var(--nav-text); text-decoration: none; }
.adm-brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.adm-brand a { color: var(--nav-text); font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.adm-brand small { color: var(--nav-text-2); font-size: 12px; }
.adm-context {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--nav-bg-2); color: var(--nav-text); font-family: var(--mono); font-size: 12.5px;
}
.adm-context a { color: var(--nav-text); }
.adm-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 2px; }
.adm-nav a {
  display: inline-block; padding: 6px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; line-height: 1.2;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.adm-nav a:hover { background: var(--nav-bg-2); color: var(--nav-text); }
.adm-nav a.is-active { background: var(--nav-bg-2); color: var(--nav-text); box-shadow: inset 0 -2px 0 var(--accent); }
.adm-nav .sep { width: 1px; height: 18px; background: oklch(100% 0 0 / 0.12); margin: 0 6px; }

/* ---------------------------------------------------------------- main frame */
.adm-main, #main, #editor_main {
  max-width: 1440px;
  margin: 0 auto;   /* bootstrap_essentials.css gives #main a 60px top margin: the fixed bar is padded for instead */
  padding: calc(var(--topbar-h) + 24px) 24px 40px;
}
.adm-main.is-wide { max-width: none; padding-left: 16px; padding-right: 16px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px;
  margin-bottom: 20px;
}
.page-head h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.page-head .count { font-size: 13px; font-weight: 500; color: var(--text-3); }
.page-head .actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.page-head .lead { flex-basis: 100%; color: var(--text-2); margin: -6px 0 0; max-width: 70ch; }

/* flash (web2py.js writes into .w2p_flash) */
.w2p_flash {
  position: fixed; top: calc(var(--topbar-h) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 5620; width: auto; min-width: 280px; max-width: 60%;
  padding: 10px 40px 10px 16px; border-radius: var(--radius);
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-2);
  font-size: 13.5px; text-align: left; cursor: default; margin: 0; border: 0;
}
.w2p_flash:empty { display: none; }
span#closeflash {
  position: absolute; top: 4px; right: 8px; width: auto; border: 0; font-size: 18px; line-height: 1;
  color: var(--nav-text-2); cursor: pointer;
}
span#closeflash:hover { color: var(--surface); font-weight: normal; }

/* footer */
.adm-footer {
  max-width: 1440px; margin: 0 auto; padding: 18px 24px 28px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  color: var(--text-3); font-size: 12.5px;
}
.adm-footer select { margin: 0; width: auto; height: 28px; font-size: 12.5px; }
.adm-footer .spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons */
.btn, a.btn, button.btn, input.btn, input[type="submit"], input[type="button"], button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px; margin: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); background-image: none;
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 500; line-height: 1;
  text-shadow: none; box-shadow: var(--shadow-1); cursor: pointer; white-space: nowrap;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
  filter: none;
}
.btn:hover, .btn:focus, a.btn:hover, input[type="submit"]:hover, button[type="submit"]:hover {
  background: var(--surface-2); border-color: var(--text-3); color: var(--text); text-decoration: none; box-shadow: var(--shadow-1);
}
.btn:active, .btn.active { background: var(--surface-3); box-shadow: inset 0 1px 2px oklch(20% 0.02 60 / 0.08); }
.btn.disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn span { display: inline; }
.btn-mini, a.btn-mini, .btn.btn-mini { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-small { height: 27px; padding: 0 10px; font-size: 12.5px; }
.btn-large { height: 36px; padding: 0 16px; font-size: 14px; }
/* primary: the one accent */
.btn-primary, .btn.btn-inverse, a.btn.btn-inverse, .btn-inverse {
  background: var(--accent); border-color: var(--accent); color: oklch(99% 0.01 75);
}
.btn-primary:hover, .btn-inverse:hover, .btn.btn-inverse:hover, a.btn.btn-inverse:hover {
  background: var(--accent-hover); border-color: var(--accent-hover); color: oklch(99% 0.01 75);
}
.btn-danger, .btn.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover, .btn.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn-warning, .btn.btn-warning { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-success, .btn.btn-success { background: var(--surface); border-color: var(--success); color: var(--success); }
.btn-link { border-color: transparent; background: transparent; box-shadow: none; color: var(--accent-text); }
.btn-link:hover { background: var(--accent-soft); border-color: transparent; }
.btn-group { display: inline-flex; align-items: center; }
.btn-group > .btn + .btn { margin-inline-start: -1px; }
.btn-group > .btn:not(:first-child):not(:last-child) { border-radius: 0; }
.btn-group > .btn:first-child:not(:last-child) { border-start-end-radius: 0; border-end-end-radius: 0; }
.btn-group > .btn:last-child:not(:first-child) { border-start-start-radius: 0; border-end-start-radius: 0; }
.btn-toolbar { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.btn-toolbar > .btn-group + .btn-group { margin: 0; }
.caret { border-top-color: currentColor; margin-inline-start: 2px; opacity: 0.7; }
.row-buttons, .buttons-row, .controls-inline, .row_buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-buttons .btn, .buttons-row .btn, .row_buttons .btn, .controls-inline .btn { margin: 0; }

/* dropdown menus (Bootstrap 2 markup) */
.dropdown-menu {
  min-width: 190px; padding: 6px; margin-top: 4px; text-align: left;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-2);
}
.dropdown-menu > li > a {
  padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 13px; line-height: 1.3;
}
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-menu > .active > a {
  background: var(--accent-soft); background-image: none; color: var(--accent-text); filter: none;
}
.dropdown-menu .divider { margin: 6px 0; background: var(--border); border: 0; height: 1px; }
.dropdown-menu .danger > a { color: var(--danger); }
.dropdown-menu .danger > a:hover { background: var(--danger-soft); color: var(--danger); }
.pull-right > .dropdown-menu, .dropdown-menu.is-end { right: 0; left: auto; }

/* ---------------------------------------------------------------- forms */
label { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
label.checkbox, label.radio { display: flex; align-items: center; gap: 6px; padding: 0; font-weight: 400; color: var(--text); min-height: 0; }
label.checkbox input, label.radio input { float: none; margin: 0; }
input[type="text"], input[type="password"], input[type="input"], input[type="search"], input[type="number"],
input[type="email"], input[type="url"], textarea, select, .uneditable-input {
  display: block; box-sizing: border-box; width: 100%; max-width: 420px; height: 32px; margin: 0 0 10px;
  padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-family: var(--font); font-size: 13.5px; line-height: 20px;
  box-shadow: inset 0 1px 2px oklch(20% 0.02 60 / 0.04);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
textarea { height: auto; min-height: 90px; line-height: 1.5; }
select { padding-right: 28px; }
input:focus, textarea:focus, select:focus, .uneditable-input:focus {
  border-color: var(--accent); outline: 0;
  box-shadow: 0 0 0 3px oklch(64% 0.17 55 / 0.18);
}
input[readonly], .uneditable-input, input.uneditable-input { background: var(--surface-2); color: var(--text-2); cursor: default; }
input[type="file"] { display: block; width: 100%; max-width: 420px; margin: 0 0 10px; font-size: 13px; color: var(--text-2); line-height: 1.4; height: auto; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); vertical-align: middle; }
.help-block, input + .help-block { display: block; margin: -6px 0 8px; color: var(--text-3); font-size: 12px; }
.controls { margin: 0; }
.controls > .btn + .btn { margin-inline-start: 6px; }
.control-group { margin-bottom: 12px; }
.control-label { text-align: left; width: auto; padding: 0; float: none; }
form { margin: 0; }
.form-stack label { margin-top: 8px; }
.form-stack label:first-child { margin-top: 0; }
.form-stack .controls { margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.well, .well-small, .generatedbyw2p {
  padding: 14px 16px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; min-height: 0;
}
.generatedbyw2p label { margin-top: 8px; }
.generatedbyw2p label:first-child { margin-top: 0; }
.generatedbyw2p .controls { margin-top: 10px; }
.generatedbyw2p input[type="text"], .generatedbyw2p input[type="file"] { max-width: 100%; }
.searchbox { display: inline-flex; align-items: center; gap: 6px; }
.searchbox label { margin: 0; cursor: pointer; }
.searchbox input, .search input { margin: 0; height: 30px; width: 220px; max-width: 100%; }
.searchbox img { opacity: 0.6; }
.searchbox label:hover img { opacity: 1; }
div.error_wrapper { margin: -6px 0 8px; padding: 0; color: var(--danger); font-size: 12.5px; }
.error, .text-error { color: var(--danger); }

/* ---------------------------------------------------------------- tables */
.table, table.data-table { width: 100%; margin-bottom: 14px; border-collapse: separate; border-spacing: 0; }
.table th, .table td { padding: 8px 10px; border-top: 1px solid var(--border); text-align: left; vertical-align: middle; line-height: 1.4; }
.table th {
  background: var(--surface-2); background-image: none; filter: none;
  color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border-top: 0; border-bottom: 1px solid var(--border-strong);
}
.table-condensed th, .table-condensed td { padding: 6px 8px; }
.table-hover tbody tr:hover > td { background: var(--surface-2); }
.table tbody tr:first-child td { border-top: 0; }
.table.is-boxed { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.table.is-boxed th:first-child, .table.is-boxed td:first-child { padding-inline-start: 14px; }
.table.is-boxed th:last-child, .table.is-boxed td:last-child { padding-inline-end: 14px; }
td.cbcentered, th.cbcentered { text-align: center; width: 36px; }
td.cbcentered > input, th.cbcentered > input { margin: 0; }
table.versions th, table.versions td, .inspect table th, .inspect table td { padding: 5px 12px 5px 0; vertical-align: top; text-align: left; border-top: 1px solid var(--border); font-size: 13px; }
table.versions th, .inspect table th { color: var(--text-2); font-weight: 500; white-space: nowrap; width: 1%; font-family: var(--mono); font-size: 12.5px; }
table.versions tr:first-child th, table.versions tr:first-child td, .inspect table tr:first-child th, .inspect table tr:first-child td { border-top: 0; }

/* labels / alerts (Bootstrap 2 names) */
.label, .badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; line-height: 1.4; text-shadow: none; vertical-align: middle;
}
.label-info { background: var(--accent-soft); color: var(--accent-text); }
.label-important, .label-danger { background: var(--danger-soft); color: var(--danger); }
.label-success { background: var(--success-soft); color: var(--success); }
.alert {
  padding: 10px 14px; margin: 0 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--warning-soft); color: var(--text); text-shadow: none;
}
.alert-error, .alert-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.alert-info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.alert.w2p_flash { border: 0; }
.hide { display: none; }

/* chips for states */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.chip--running { background: var(--success-soft); color: var(--success); }
.chip--disabled { background: var(--danger-soft); color: var(--danger); }
.chip--compiled { background: var(--accent-soft); color: var(--accent-text); }

/* tooltips (Bootstrap 2) */
.tooltip-inner { background: var(--text); color: var(--surface); border-radius: var(--radius-sm); font-family: var(--font); font-size: 12px; padding: 5px 9px; max-width: 260px; }
.tooltip.right .tooltip-arrow { border-right-color: var(--text); }
.tooltip.top .tooltip-arrow { border-top-color: var(--text); }
a[rel='tooltip'] span, div[rel='tooltip'] span { display: none; }
.helpicon, a[rel='tooltip'] img { width: 14px; height: 14px; opacity: 0.45; vertical-align: -2px; transition: opacity 150ms var(--ease); }
a[rel='tooltip']:hover img { opacity: 0.9; }

/* ---------------------------------------------------------------- site: application list */
/* The list is dense on purpose: one line per application, actions next to the name
   instead of pushed to the far edge of a wide row. */
/* the list column is as wide as the list needs, the side panels sit right next to it */
.site-grid { display: grid; grid-template-columns: minmax(0, max-content) 340px; gap: 24px; justify-content: start; align-items: start; }
@media (max-width: 1000px) { .site-grid { grid-template-columns: minmax(0, 1fr); } }
.apps { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; }
.apps table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; table-layout: auto; }
.apps-bar { padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.apps-bar input { width: 100%; max-width: none; height: 26px; margin: 0; font-size: 12.5px; background: var(--surface); }
.apps td { padding: 3px 12px; border-top: 1px solid var(--border); vertical-align: middle; line-height: 1.3; }
.apps th:first-child, .apps td:first-child { width: 1%; white-space: nowrap; padding-inline-end: 6px; }
.apps th:last-child, .apps td:last-child { text-align: left; padding-inline-start: 0; }  /* actions sit next to the name, not at the far edge */
.apps tbody tr:first-child td { border-top: 0; }
.apps tbody tr:hover td { background: var(--surface-2); }
.apps tbody tr:first-child td:first-child { border-start-start-radius: 0; }
.apps tbody tr:last-child td:first-child { border-end-start-radius: var(--radius); }
.apps tbody tr:last-child td:last-child { border-end-end-radius: var(--radius); }
.app-name { display: flex; align-items: center; gap: 8px; }
.app-name > a, .app-name > strong { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.app-name > a:hover { color: var(--accent-text); }
.app-name .owner { color: var(--text-3); font-size: 11.5px; }
.app-actions { display: inline-flex; align-items: center; gap: 3px; }
.app-actions .btn { height: 22px; padding: 0 7px; font-size: 12px; box-shadow: none; border-color: transparent; background: transparent; color: var(--text-2); }
.app-actions .btn:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.app-actions .btn-group { margin-inline-start: 2px; }
.apps .chip { padding: 0 7px; font-size: 11px; line-height: 16px; }
.apps .chip::before { width: 5px; height: 5px; }
.btn .state-off { color: var(--danger); }      /* application is disabled: offer "Enable" in the alert color */
.btn .state-on { color: var(--text-2); }
.apps .empty { padding: 30px; text-align: center; color: var(--text-3); }
tr.is-hidden { display: none; }

/* sidebar panels — same density as the application list */
.aside { display: flex; flex-direction: column; gap: 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 12px; }
.panel--quiet { background: transparent; border-style: dashed; }
.panel h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
/* collapsible panels: <details data-panel>, closed until the user opens them */
details.panel { padding: 0; }
details.panel > summary {
  display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
  padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text);
  border-radius: var(--radius); user-select: none;
  transition: background 150ms var(--ease);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::marker { content: ""; }
details.panel > summary::before {
  content: ""; flex: none; width: 0; height: 0;
  border-left: 5px solid var(--text-3); border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  transition: transform 150ms var(--ease);
}
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > summary:hover { background: var(--surface-2); }
details.panel > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
details.panel[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--border); }
details.panel .summary-note { margin-inline-start: auto; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--text-3); }
details.panel > .panel-body { padding: 10px 12px 12px; }
details.panel > .panel-body > *:last-child { margin-bottom: 0; }
.panel .meta { color: var(--text-2); font-size: 12.5px; line-height: 1.45; margin-bottom: 8px; }
.panel .meta code { font-size: 11.5px; padding: 0 4px; }
.panel .links { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.panel input[type="text"], .panel input[type="file"], .panel input[type="password"] { max-width: 100%; }
.panel .row-buttons { margin: 0; }
.aside .top-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.aside .top-actions .btn { height: 26px; padding: 0 10px; font-size: 12.5px; }
/* compact form controls inside the panels */
.aside label { margin-bottom: 2px; font-size: 11.5px; }
.aside input[type="text"], .aside input[type="password"], .aside input[type="search"], .aside select { height: 28px; margin-bottom: 8px; font-size: 12.5px; padding: 3px 8px; }
.aside input[type="file"] { margin-bottom: 8px; font-size: 12px; }
.aside .help-block { margin: -6px 0 8px; font-size: 11.5px; }
.aside .btn { height: 26px; padding: 0 10px; font-size: 12.5px; }
.aside .form-stack .controls { margin-top: 0; gap: 8px; }
.aside .panel > form > *:last-child { margin-bottom: 0; }
/* input + button on one line */
.field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.field-row input { flex: 1; min-width: 0; margin: 0 !important; }
.field-row .btn { flex: none; }

/* ---------------------------------------------------------------- design page */
.toolbar {
  position: sticky; top: var(--topbar-h); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 0 12px; margin: 0 0 8px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.toolbar .jumps { display: flex; flex-wrap: wrap; gap: 4px; margin-inline-start: auto; }
.toolbar .jumps a { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid transparent; }
.toolbar .jumps a:hover { color: var(--accent-text); background: var(--accent-soft); text-decoration: none; }
.section { margin: 0 0 22px; }
.section__head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.section__head h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.section__head .component { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 8px; }
.section__head .component::before {
  content: ""; width: 0; height: 0; border-left: 6px solid var(--text-3); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg); transition: transform 180ms var(--ease);
}
.section__head.is-collapsed .component::before { transform: rotate(0deg); }
.section__head .count { font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-3); padding: 1px 8px; border-radius: 999px; }
.section__head .tophashlink { margin-inline-start: auto; visibility: hidden; }
.hashstick:target ~ .tophashlink, .section__head:hover .tophashlink { visibility: visible; }
.section__head .tophashlink.btn { height: 22px; padding: 0 8px; font-size: 11.5px; color: var(--text-2); }
[rel="pagebookmark"] { position: relative; }
[rel="pagebookmark"] > .hashstick { position: absolute; top: calc(-1 * var(--topbar-h) - 60px); left: 0; width: 1px; height: 1px; overflow: hidden; }
.section__tools, .comptools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.section__tools .btn, .comptools .btn { height: 26px; padding: 0 10px; font-size: 12.5px; }
.component_contents > p > strong { font-weight: 500; color: var(--text-3); }
.component_contents .empty { color: var(--text-3); font-size: 13px; padding: 6px 0 4px; }

/* file rows */
ul.act_edit, ul.unstyled { list-style: none; margin: 0; padding: 0; }
ul.act_edit > li {
  display: grid; grid-template-columns: 104px minmax(160px, 28%) minmax(0, 1fr); align-items: start; gap: 4px 14px;
  padding: 6px 8px; border-radius: var(--radius-sm); border-top: 1px solid transparent;
}
ul.act_edit > li:hover { background: var(--surface-2); }
ul.act_edit > li + li { border-top-color: var(--border); }
ul.act_edit > li:hover + li { border-top-color: transparent; }
ul.act_edit > li > .hashstick { grid-column: 1; }
ul.act_edit .filetools, ul.act_edit .filetols, ul.act_edit .li-controls .filetools { display: inline-flex; align-items: center; gap: 2px; grid-column: 1; }
ul.act_edit .btn { margin: 0; }
ul.act_edit .editbutton { height: 24px; padding: 0 9px; font-size: 12px; }
ul.act_edit .file { grid-column: 2; font-family: var(--mono); font-size: 13px; padding-top: 3px; word-break: break-all; }
ul.act_edit .file > a { white-space: normal; color: var(--text); }
ul.act_edit .file > a:hover { color: var(--accent-text); }
ul.act_edit .extras, ul.act_edit .celled { grid-column: 3; width: auto; display: block; margin: 0; padding: 3px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
ul.act_edit .extras b { font-weight: 600; color: var(--text); font-family: var(--mono); font-size: 12.5px; }
ul.act_edit .extras a { font-family: var(--mono); font-size: 12.5px; }
ul.act_edit .li-controls { display: contents; width: auto; }
ul.act_edit .li-controls > span:not(.filetools) { grid-column: 2; font-family: var(--mono); font-size: 13px; padding-top: 3px; }
/* icon buttons (delete / test) : hide the legacy PNG, draw a crisp glyph */
a.icon.delete, a.icon.test {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: var(--radius-sm); color: var(--text-3); position: relative;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
a.icon.delete img, a.icon.test img { display: none; }
a.icon.delete::before, a.icon.test::before {
  content: ""; width: 14px; height: 14px; background-color: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}
a.icon.delete { --glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M6 2h4l.5 1H13v1.5H3V3h2.5L6 2zm-1.5 4h7l-.6 8H5.1L4.5 6zm2 1.5v5h1v-5h-1zm2 0v5h1v-5h-1z'/></svg>"); }
a.icon.test   { --glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M6 2h4v1.5H9V6l3.7 6.3A1.4 1.4 0 0 1 11.5 14h-7a1.4 1.4 0 0 1-1.2-2.1L7 6V3.5H6V2zm1.5 1.5v3L5.6 9.5h4.8L8.5 6.5v-3h-1z'/></svg>"); }
a.icon.delete:hover { background: var(--danger-soft); color: var(--danger); }
a.icon.test:hover { background: var(--accent-soft); color: var(--accent-text); }
/* folders inside static / private */
ul.act_edit li.folder { display: block; padding: 4px 8px; border-top: 0; }
ul.act_edit li.folder > i { display: none; }
ul.act_edit li.folder > a.file { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-2); }
ul.act_edit li.folder > a.file::before { content: "▸ "; color: var(--text-3); }
ul.act_edit li.folder > ul.sublist { margin: 2px 0 4px 14px; padding-inline-start: 10px; border-inline-start: 1px solid var(--border); }
ul.act_edit li.folder > ul.sublist > li { padding-inline-start: 6px; }
ul.act_edit li.folder:hover { background: transparent; }
.formfield { margin: 8px 0 0; }
.formfield > .btn { height: 26px; padding: 0 10px; font-size: 12.5px; }
.formfield .row-fluid { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.formfield .span3 { width: 360px; max-width: 100%; margin: 0; float: none; }
.formfield em { display: block; margin: 8px 0; color: var(--text-3); font-size: 12.5px; font-style: normal; }

/* ---------------------------------------------------------------- errors & tickets */
.errorform .tablebar { display: flex; align-items: center; gap: 12px; margin: 10px 0 10px; }
.errorform .tablebar input { margin: 0; }
#trck_errors { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
#trck_errors td a { color: var(--text); }
#trck_errors td a:hover { color: var(--accent-text); }
#trck_errors .error_ticket td { cursor: pointer; }
#trck_errors .traceback td { background: var(--code-bg); padding: 0; }
.ticket_code { background: transparent; padding: 10px 14px; }
.ticket_code pre, .ticket_code table { margin: 0; background: transparent; border: 0; }
.ticket_code > table td { border: 0; padding: 0; }
.uneditable-input.source { display: inline-block; width: auto; height: 30px; margin: 0; line-height: 18px; }
.errors-switch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.ticket .inspect { margin: 0 0 12px; }
.ticket .inspect.resp1 { padding: 12px 14px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
.ticket .inspect.resp1 pre { border: 0; padding: 0; background: transparent; margin: 0; }
.ticket h3 { margin: 22px 0 10px; }
.ticket h4 { margin: 14px 0 8px; }
.ticket p.exception_object code { display: inline-block; padding: 6px 10px; font-size: 13px; color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.ticket #frames > ul > li { margin: 0 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ticket .framefile { padding: 10px 14px; margin: 0; }
.ticket .framefile > p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.ticket .framefile > p > strong { font-weight: 500; font-family: var(--mono); font-size: 12.5px; color: var(--text); margin-inline-end: auto; }
.ticket .framefile .tbbutton { height: 24px; padding: 0 9px; font-size: 12px; }
.ticket .framefile > div { margin-top: 10px; }
.ticket .framefile h5 { margin: 0 0 6px; }
.ticket .viewenv p.controls { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ticket .errorsource { margin-top: 24px; }
.ticket .errorsource h3 { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text-2); }
/* CODE() output */
table.highlight, .highlight table { border: 0; }
.ticket_code pre, .inspect pre, .errorsource pre, .peek pre, .code-wrapper pre { word-break: normal; white-space: pre; }
.lineno { color: var(--text-3); }

/* ---------------------------------------------------------------- login */
.login-wrap { max-width: 420px; margin: 8vh auto 0; }
.login-wrap h2 { margin-bottom: 4px; }
.login-wrap .lead { color: var(--text-2); margin-bottom: 18px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px 22px; box-shadow: var(--shadow-1); }
.login-card input[type="password"] { max-width: 100%; }
.login-card .controls { margin-top: 12px; }
.login-note { margin-top: 14px; }

/* ---------------------------------------------------------------- misc pages */
.legalese { max-width: 80ch; white-space: pre-wrap; font-size: 13px; }
.center { text-align: center; }
#confirm_form { display: inline-flex; gap: 8px; align-items: center; }
.about h3, .peek h3, .plugins h3, .pack_custom h3, .test h3 { margin: 18px 0 8px; }
p.controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.peek .code-wrapper { border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: auto; }
.peek .code-wrapper pre, .peek .code-wrapper table { margin: 0; border: 0; }
.test h3 { padding-left: 10px; border-left-width: 4px; }

/* ---------------------------------------------------------------- editor page */
body.edit .adm-main { max-width: none; padding-bottom: 60px; }
body.edit .btn-toolbar { justify-content: flex-end; margin-bottom: 8px; }
#files { background: var(--nav-bg); border-right: 1px solid oklch(100% 0 0 / 0.08); opacity: 1; z-index: 1031; }
.files-toggle { background: var(--nav-bg); color: var(--nav-text-2); }
#filelist { top: var(--topbar-h); padding: 10px 10px 60px; }
#filelist li { padding: 0; width: auto; }
#filelist li > a, #files a { color: var(--nav-text-2); font-family: var(--mono); font-size: 12.5px; padding: 3px 8px; border-radius: var(--radius-sm); display: block; }
#filelist li > a:hover, #files a:hover { color: var(--nav-text); background: var(--nav-bg-2); text-decoration: none; }
#files .nav-list > li > a { text-shadow: none; }
#files .nav-header, #files .nav-list .nav-header { color: var(--nav-text); font-size: 11.5px; letter-spacing: 0.05em; text-shadow: none; padding: 10px 8px 4px; }
#files input.search-query { background: var(--nav-bg-2); border-color: transparent; color: var(--nav-text); max-width: 100%; border-radius: var(--radius-sm); }
#files input.search-query::placeholder { color: var(--nav-text-2); }
#files .btn { background: var(--nav-bg-2); border-color: transparent; color: var(--nav-text); box-shadow: none; }
#files #form .well { background: var(--nav-bg-2); border-color: transparent; color: var(--nav-text); }
#files #form label { color: var(--nav-text-2); }
#files #form select, #files #form input[type="text"] { background: var(--nav-bg); border-color: oklch(100% 0 0 / 0.15); color: var(--nav-text); }
.nav-tabs { border-bottom: 1px solid var(--border); margin: 0 0 10px; }
.nav-tabs > li > a { padding: 6px 12px; margin: 0 2px -1px 0; border: 1px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: var(--text-2); font-size: 13px; }
.nav-tabs > li > a:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.nav-tabs > .active > a, .nav-tabs > .active > a:hover { background: var(--surface); border-color: var(--border) var(--border) var(--surface); color: var(--text); }
.nav-tabs > li > a .close { margin-inline-start: 8px; line-height: 1; opacity: 0.4; text-shadow: none; }
#editform.well, #editform .well { padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
#editform label { margin: 0; }
#editform input.uneditable-input { display: inline-block; width: auto; margin: 0; height: 28px; font-family: var(--mono); font-size: 12px; }
#editform .input-long { width: 260px; } #editform .input-normal { width: 190px; }
#editform .saveicon { display: inline-flex; align-items: center; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
#editform .btn-inverse, #editform .btn-inverse:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }  /* "toggle breakpoint" is not the primary action */
#editform p.formfield { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.navbar-fixed-bottom { border-top: 1px solid var(--border); }
.navbar-fixed-bottom .navbar-inner { background: var(--nav-bg); background-image: none; border: 0; box-shadow: none; min-height: 36px; }
.navbar-fixed-bottom .nav > li > a { padding: 9px 14px; color: var(--nav-text-2); text-shadow: none; font-size: 13px; }
.navbar-fixed-bottom .nav > li > a:hover, .navbar-fixed-bottom .nav > .active > a { color: var(--nav-text); background: var(--nav-bg-2); box-shadow: none; }
#windows_divs .tab-pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-top: 10px; }
.keybindings span { padding: 3px 7px; }
.teletype-text { background: var(--nav-bg); color: var(--nav-text); border-radius: var(--radius-sm); font-size: 12px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 767px) {
  .adm-top { height: auto; flex-wrap: wrap; padding: 8px 14px; gap: 8px; position: relative; }
  .adm-nav { margin-inline-start: 0; flex-wrap: wrap; width: 100%; }
  .adm-main, #main, #editor_main { padding: 16px 16px 32px; }
  /* application list: one block per app, actions wrap under the name */
  .apps table, .apps tbody, .apps tr, .apps td { display: block; width: auto; }
  .apps thead { display: none; }
  .apps td { border-top: 0; padding: 6px 12px 2px; }
  .apps td:last-child { padding: 0 12px 6px; text-align: left; }
  .apps tr { border-top: 1px solid var(--border); }
  .apps tbody tr:first-child { border-top: 0; }
  .app-actions { flex-wrap: wrap; }
  .toolbar { position: static; }
  ul.act_edit > li { grid-template-columns: 104px minmax(0, 1fr); }
  ul.act_edit .extras, ul.act_edit .celled { grid-column: 2; }
  .w2p_flash { max-width: calc(100% - 32px); }
}

/* ---------------------------------------------------------------- appadmin (standalone views/appadmin.html) */
.data-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.data-list table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; }
.data-list td { padding: 8px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.data-list td:last-child { text-align: right; }
.data-list tbody tr:first-child td { border-top: 0; }
.data-list tbody tr:hover td { background: var(--surface-2); }
.data-list .empty { padding: 26px; text-align: center; color: var(--text-3); }
.appadmin .section__head small { color: var(--text-3); font-weight: 400; }
.appadmin .section__head.is-collapsed .component::before { transform: rotate(0deg); }
.appadmin td, .appadmin th, .appadmin .state-dump { unicode-bidi: plaintext; }   /* Arabic data inside an LTR console */
.crumb { color: var(--text-3); font-weight: 400; margin: 0 2px; }
.page-head.rows-head { margin-top: 18px; align-items: center; }
.appadmin .empty { color: var(--text-3); padding: 14px 0; }
.w2p_hidden { display: none; }
/* query form of "select": FORM(TABLE(TR(label, input) ...)) */
.query-panel form table { width: 100%; border-collapse: collapse; }
.query-panel form td { padding: 4px 8px 4px 0; vertical-align: middle; font-size: 13px; color: var(--text-2); }
.query-panel form td:first-child { width: 90px; white-space: nowrap; }
.query-panel form input[type="text"], .query-panel form input.form-control { max-width: none; margin: 0; font-family: var(--mono); font-size: 13px; }
.query-panel form input[type="checkbox"] { margin-inline-end: 6px; }
.query-panel form input[type="submit"] { margin-top: 6px; }
.query-panel .meta { margin: 12px 0 0; max-width: 90ch; }
.form-title { margin: 22px 0 10px; }
/* SQLFORM in the bootstrap4_inline / table3cols form styles */
.form-panel .form-group, .form-panel .form-group.row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px 16px; align-items: start; margin: 0 0 10px; }
.form-panel .form-group > label, .form-panel .col-form-label { margin: 0; padding-top: 7px; font-weight: 500; color: var(--text-2); text-align: left; }
.form-panel .form-group > div, .form-panel [class*="col-sm-"] { padding: 0; width: auto; float: none; max-width: none; flex: none; }
.form-panel .offset-sm-3, .form-panel .offset-sm-2 { grid-column: 2; margin: 0; }
.form-panel .form-control, .form-panel input[type="text"], .form-panel input[type="password"], .form-panel textarea, .form-panel select { max-width: 640px; margin: 0; }
.form-panel textarea { min-height: 120px; }
.form-panel .form-text, .form-panel .help-block, .form-panel .w2p_fc { margin: 4px 0 0; color: var(--text-3); font-size: 12px; }
.form-panel .form-check { display: flex; align-items: center; gap: 6px; padding-top: 7px; }
.form-panel .form-check input { margin: 0; }
.form-panel div.error, .form-panel .error_wrapper, .form-panel .invalid-feedback { display: block; color: var(--danger); font-size: 12.5px; margin-top: 4px; }
.form-panel table { border-collapse: collapse; }
.form-panel td.w2p_fl { width: 220px; padding: 7px 16px 7px 0; vertical-align: top; color: var(--text-2); font-weight: 500; }
.form-panel td.w2p_fw { padding: 4px 0; }
.form-panel td.w2p_fc { padding: 4px 0 4px 12px; color: var(--text-3); font-size: 12px; vertical-align: top; }
.form-panel input[type="submit"], .form-panel button[type="submit"] { margin-top: 6px; }
.form-panel .btn-primary, .form-panel input.btn-primary { background: var(--accent); border-color: var(--accent); color: oklch(99% 0.01 75); }
.form-panel input[type="file"] { max-width: none; }
/* record tables (SQLTABLE) */
.table-scroll { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; max-height: 70vh; }
.table-scroll .table { margin: 0; width: max-content; min-width: 100%; }
.table-scroll .table th { position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table-scroll .table td { white-space: nowrap; max-width: 480px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.table-scroll .table th a { color: var(--text-2); }
.table-scroll .table th a:hover { color: var(--accent-text); }
.table-scroll .table td a { font-family: var(--mono); font-size: 12.5px; }
.table-scroll .table-bordered td, .table-scroll .table-bordered th { border-left: 1px solid var(--border); }
.table-scroll .table-bordered td:first-child, .table-scroll .table-bordered th:first-child { border-left: 0; }
.table-scroll .table-striped tbody tr:nth-child(odd) td { background: transparent; }
.table-scroll .table tbody tr.highlight td, .table-scroll .table-hover tbody tr:hover td { background: var(--accent-soft); }
/* state / cache */
.state-dump { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; overflow: auto; font-size: 12.5px; }
.state-dump table { border-collapse: collapse; }
.state-dump th, .state-dump td { padding: 3px 12px 3px 0; vertical-align: top; text-align: left; border-top: 1px solid var(--border); }
.state-dump th { color: var(--text-2); font-weight: 500; font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.state-dump tr:first-child th, .state-dump tr:first-child td { border-top: 0; }
.cache-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px; }
.cache-grid .panel h4 { margin-bottom: 6px; }
.cache-grid .panel .meta { margin-bottom: 6px; }
.cache-grid .keys { margin-top: 10px; padding: 8px 10px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; word-break: break-all; max-height: 260px; overflow: auto; }
/* hooks list from appadmin/hooks */
.hooks ul.nav-list { list-style: none; margin: 0 0 0 14px; padding: 0; }
.hooks > ul.nav-list { margin: 0; }
.hooks ul.nav-list > a { display: block; padding: 5px 0; font-family: var(--mono); font-size: 13px; cursor: pointer; }
.hooks ul.nav-list li { font-size: 12.5px; color: var(--text-2); padding: 2px 0; }
#vis.panel { min-height: 480px; }
