/* Isolated admin chrome and dashboard. Existing record-editor styles stay intact. */
:root {
  --hd-bg: #f5f6f1;
  --hd-surface: #fff;
  --hd-soft: #f1f5ed;
  --hd-ink: #243d30;
  --hd-muted: #657369;
  --hd-green: #174f39;
  --hd-line: #dde5da;
  --hd-accent: #dceac9;
  --hd-focus: #33865c;
}
html[data-theme="dark"] {
  --hd-bg: #131d18;
  --hd-surface: #1c2921;
  --hd-soft: #26372b;
  --hd-ink: #e6eee3;
  --hd-muted: #aabbac;
  --hd-green: #b1d69c;
  --hd-line: #384a3b;
  --hd-accent: #32472e;
  --hd-focus: #b1d69c;
}
body.hd-auth-page, body.hd-workspace-page {
  margin: 0;
  background: var(--hd-bg);
  color: var(--hd-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-width: 0;
}
/* Record editors still use the legacy component tokens. Define them on the
   page, not a retired sidebar wrapper, so dialogs inherit them as well. */
body.hd-workspace-page {
  --admin-ink: var(--hd-ink);
  --admin-muted: var(--hd-muted);
  --admin-leaf: #236647;
  --admin-leaf-dark: var(--hd-green);
  --admin-mint: var(--hd-accent);
  --admin-paper: var(--hd-surface);
  --admin-cream: var(--hd-soft);
  --admin-line: var(--hd-line);
  --admin-shadow: 0 16px 40px #1024190a;
  --bs-body-color: var(--hd-ink);
  --bs-body-bg: var(--hd-surface);
  --bs-emphasis-color: var(--hd-ink);
  --bs-secondary-color: var(--hd-muted);
  --bs-secondary-bg: var(--hd-soft);
  --bs-tertiary-bg: var(--hd-soft);
  --bs-border-color: var(--hd-line);
  --bs-heading-color: var(--hd-ink);
}
.hd-workspace-page :is(.soft-card, .metric-card, .admin-card) { background: var(--hd-surface); color: var(--hd-ink); border-color: var(--hd-line); }
.hd-workspace-page :is(.gain-pill, .mint-pill) { color: var(--hd-green); background: var(--hd-accent); }
.hd-workspace-page .table { --bs-table-color: var(--hd-ink); --bs-table-border-color: var(--hd-line); }
.hd-workspace-page .table thead th { color: var(--hd-muted); background: var(--hd-soft); }
.hd-workspace-page .btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #174f39;
  --bs-btn-border-color: #174f39;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #236647;
  --bs-btn-hover-border-color: #236647;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #103e2b;
  --bs-btn-active-border-color: #103e2b;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #174f39;
  --bs-btn-disabled-border-color: #174f39;
  color: #fff;
  background: #174f39;
  border-color: #174f39;
}
.hd-workspace-page .btn-success:is(:hover, :focus-visible) { color: #fff; background: #236647; border-color: #236647; }
.hd-workspace-page .btn-success:is(:active, .active) { color: #fff; background: #103e2b; border-color: #103e2b; }
.hd-workspace-page .btn-outline-success { color: var(--hd-green); background: transparent; border-color: var(--hd-green); }
.hd-workspace-page .btn-outline-success:is(:hover, :focus-visible, :active) { color: #fff; background: #174f39; border-color: #174f39; }
body.hd-workspace-page .admin-icon-button { color: var(--hd-green); background: var(--hd-soft); border-color: var(--hd-line); }
body.hd-workspace-page .admin-icon-button:hover { color: var(--hd-green); background: var(--hd-accent); transform: none; }
.hd-workspace-page :is(.form-control, .form-select) { min-width: 0; background-color: var(--hd-surface); color: var(--hd-ink); border-color: var(--hd-line); }
.hd-workspace-page .form-control::placeholder { color: var(--hd-muted); opacity: 1; }
.hd-workspace-page .form-check-input { border-color: var(--hd-muted); background-color: var(--hd-surface); }
.hd-workspace-page .form-check-input:checked { background-color: #174f39; border-color: #174f39; }
/* An opaque, bounded dialog keeps the underlying page out of the form. The
   form is a flex child so only its body scrolls, never its header/footer. */
.hd-workspace-page .modal { --bs-modal-margin: 1rem; --bs-modal-bg: var(--hd-surface); --bs-modal-color: var(--hd-ink); --bs-modal-border-color: var(--hd-line); z-index: 1080; }
.hd-workspace-page .modal-backdrop { z-index: 1070; }
.hd-workspace-page .admin-modal-dialog { width: calc(100% - 2rem); max-width: 900px; margin: 1rem auto; }
.hd-workspace-page .admin-modal { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); overflow: hidden; background: var(--hd-surface); color: var(--hd-ink); border: 1px solid var(--hd-line); }
.hd-workspace-page .admin-modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.hd-workspace-page .admin-modal .modal-header { flex-shrink: 0; gap: 12px; background: var(--hd-soft); border-color: var(--hd-line); }
.hd-workspace-page .admin-modal .modal-title { color: var(--hd-ink); overflow-wrap: anywhere; }
.hd-workspace-page .admin-modal .modal-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; background: var(--hd-surface); color: var(--hd-ink); }
.hd-workspace-page .admin-modal .modal-footer { flex-shrink: 0; gap: 8px; background: var(--hd-surface); border-color: var(--hd-line); }
.hd-workspace-page .admin-modal .modal-footer .btn { min-height: 44px; white-space: normal; }
.hd-workspace-page .admin-modal :is(.form-text, code, .alert) { overflow-wrap: anywhere; }
.hd-workspace-page .admin-modal .row > * { min-width: 0; }
.hd-workspace-page :is(.apk-hosting-grid article, .apk-delivery-option > span) { color: var(--hd-ink); background: var(--hd-soft); border-color: var(--hd-line); }
.hd-workspace-page :is(.apk-hosting-grid i, .apk-delivery-option i) { color: var(--hd-green); background: var(--hd-accent); }
.hd-workspace-page .apk-delivery-option input:checked + span { background: var(--hd-accent); border-color: var(--hd-green); }
@media (max-width: 575px) {
  .hd-workspace-page .admin-modal .modal-header,
  .hd-workspace-page .admin-modal .modal-body,
  .hd-workspace-page .admin-modal .modal-footer { padding: 14px; }
  .hd-workspace-page .admin-modal .modal-footer .btn { flex: 1 1 120px; margin: 0; }
}
.hd-auth-page *, .hd-workspace * { box-sizing: border-box; }
.hd-auth-page a, .hd-workspace a { text-decoration: none; }
.hd-auth-page button, .hd-auth-page input, .hd-workspace button { font: inherit; }
.hd-auth-page button, .hd-workspace button { cursor: pointer; }
.hd-auth-page [hidden], .hd-workspace [hidden] { display: none !important; }
.hd-auth-page :focus-visible, .hd-workspace :focus-visible { outline: 3px solid var(--hd-focus); outline-offset: 4px; }
.hd-auth-page :is(h1,h2,h3,p,figure), .hd-dashboard :is(h2,h3,p) { margin: 0; }
.hd-auth-page .ui-icon, .hd-workspace .ui-icon { width: 21px; height: 21px; flex-shrink: 0; vertical-align: middle; }
.hd-skip { position: fixed; left: 16px; top: -90px; z-index: 2000; padding: 12px 20px; background: var(--hd-surface); color: var(--hd-ink); border: 2px solid var(--hd-green); border-radius: 8px; }
.hd-skip:focus { top: 12px; }
.hd-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--hd-green); font-size: 25px; font-weight: 800; letter-spacing: -.8px; }
.hd-brand:hover { color: var(--hd-green); }
.hd-brand img { width: 36px; height: 36px; }
.hd-eyebrow { display: block; font-size: 11px; line-height: 1.5; letter-spacing: .13em; font-weight: 750; text-transform: uppercase; color: var(--hd-muted); }
.hd-muted { color: var(--hd-muted); font-size: 13px; }
.hd-text-link { display: inline-flex; align-items: center; gap: 8px; color: var(--hd-green); font-size: 12px; font-weight: 700; }
.hd-text-link:hover { color: var(--hd-green); text-decoration: underline; text-underline-offset: 4px; }
.hd-text-link .ui-icon { width: 16px; height: 16px; }
.hd-icon-button { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--hd-line); border-radius: 10px; background: var(--hd-surface); color: var(--hd-ink); }
.hd-icon-button:hover { color: var(--hd-green); background: var(--hd-soft); }
.hd-theme-dark { display: none; }
html:not(.js) :is([data-theme-toggle], .hd-password-toggle, .hd-menu-toggle) { display: none; }
html[data-theme="dark"] .hd-theme-dark { display: inline; }
html[data-theme="dark"] .hd-theme-light { display: none; }
.hd-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 11px 17px; border: 1px solid transparent; border-radius: 9px; font-size: 13px; line-height: 1.5; font-weight: 700; text-align: center; transition: background .15s, transform .15s; }
.hd-button-primary { background: #174f39; color: #fff; border-color: #174f39; }
.hd-button-primary:hover { color: #fff; background: #236647; }
.hd-button-light { background: #f0f5de; color: #173f2e; }
.hd-button-light:hover { background: #fff; color: #173f2e; }
.hd-button-secondary { border-color: var(--hd-line); background: var(--hd-surface); color: var(--hd-green); }
.hd-button-secondary:hover { background: var(--hd-soft); color: var(--hd-green); }
.hd-button:disabled { opacity: .6; cursor: not-allowed; }
.hd-alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid; overflow-wrap: anywhere; font-size: 13px; }
.hd-alert ul { margin: 5px 0 0; padding-left: 20px; }
.hd-alert-error { color: #8b3428; background: #fff0ec; border-color: #ecc9bf; }
.hd-alert-success { color: #245537; background: #edf7e9; border-color: #c0d9b8; }
.hd-alert-warning { color: #715220; background: #fff6df; border-color: #e6d4ac; }
html[data-theme="dark"] .hd-alert-error { color: #ffc3b8; background: #402a27; border-color: #6d453b; }
html[data-theme="dark"] .hd-alert-success { color: #c0e4ae; background: #263b28; border-color: #45613e; }
html[data-theme="dark"] .hd-alert-warning { color: #ead2a5; background: #3e3420; border-color: #655534; }
/* Login */
.hd-auth-top, .hd-auth-footer { max-width: 1320px; margin: 0 auto; padding: 26px 40px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.hd-auth-top-actions { display: flex; gap: 24px; align-items: center; }
.hd-auth-main { padding: 22px 32px; }
.hd-auth-card { display: grid; grid-template-columns: 1fr 1fr; max-width: 1060px; margin: 0 auto; border: 1px solid var(--hd-line); border-radius: 22px; overflow: hidden; background: var(--hd-surface); box-shadow: 0 20px 60px #1a382408; }
.hd-auth-story { min-width: 0; background: #eaf0df; color: #243e2d; padding: 44px; }
.hd-auth-story .hd-eyebrow { color: #53654e; }
.hd-auth-story h1 { font-size: clamp(28px, 3.1vw, 42px); font-weight: 650; line-height: 1.17; letter-spacing: -1.4px; margin-top: 22px; }
.hd-auth-story h1 em { font-family: Georgia, serif; font-weight: 400; color: #4e6a35; }
.hd-auth-story > p { color: #54634e; font-size: 14px; line-height: 1.7; margin-top: 18px; max-width: 340px; }
.hd-auth-photo { margin: 30px 0 24px !important; border-radius: 14px; overflow: hidden; position: relative; background: #274733; }
.hd-auth-photo img { display: block; width: 100%; height: 190px; object-fit: cover; }
.hd-auth-photo figcaption { position: absolute; inset: auto 0 0; padding: 34px 18px 15px; background: linear-gradient(transparent, #102c20ed); color: #fff; }
.hd-auth-photo figcaption span { display: block; font-size: 10px; letter-spacing: .05em; color: #d3e3c5; }
.hd-auth-photo figcaption strong { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 16px; }
.hd-auth-photo figcaption i { font-family: Georgia, serif; font-weight: 400; font-size: 12px; }
.hd-auth-security { display: flex; align-items: flex-start; gap: 12px; font-size: 11px; line-height: 1.7; color: #52614d; }
.hd-auth-security .ui-icon { margin-top: 3px; }
.hd-auth-security strong { display: block; font-size: 12px; font-weight: 700; color: #2b4834; }
.hd-auth-form-panel { min-width: 0; padding: 48px; align-self: center; }
.hd-auth-lock { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--hd-soft); color: var(--hd-green); margin-bottom: 22px; }
.hd-auth-form-panel h2 { margin-top: 7px; font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.3; }
.hd-auth-form-panel > .hd-muted { margin-top: 10px; }
.hd-auth-form-panel .hd-alert { margin-top: 22px; }
.hd-login-form { margin-top: 30px; }
.hd-field { margin-bottom: 20px; }
.hd-field label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.hd-input-wrap { display: flex; align-items: center; padding: 0 12px; gap: 10px; background: var(--hd-surface); border: 1px solid var(--hd-line); border-radius: 9px; }
.hd-input-wrap:focus-within { outline: 2px solid var(--hd-focus); outline-offset: 2px; }
.hd-input-wrap > .ui-icon { color: var(--hd-muted); width: 18px; }
.hd-input-wrap input { min-width: 0; width: 100%; height: 48px; padding: 0; border: 0; outline: none !important; background: transparent; color: var(--hd-ink); font-size: 14px; }
.hd-input-wrap input::placeholder { color: var(--hd-muted); opacity: .9; }
.hd-input-wrap:has([aria-invalid="true"]) { border-color: #b14534; }
.hd-password-toggle { display: grid; place-items: center; border: 0; background: transparent; color: var(--hd-muted); min-width: 36px; min-height: 44px; margin-right: -7px; border-radius: 6px; }
.hd-password-toggle:hover, .hd-password-toggle[aria-pressed="true"] { color: var(--hd-green); background: var(--hd-soft); }
.hd-remember { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--hd-muted); cursor: pointer; padding: 3px 0; }
.hd-remember input { width: 16px; height: 16px; accent-color: #174f39; flex-shrink: 0; }
.hd-login-submit { width: 100%; justify-content: space-between; margin-top: 23px; min-height: 48px; }
.hd-login-status { font-size: 12px; color: var(--hd-muted); }
.hd-login-status:not(:empty) { margin-top: 10px; }
.hd-auth-note { display: flex; gap: 10px; padding: 19px 0; margin-top: 20px; border-top: 1px solid var(--hd-line); color: var(--hd-muted); font-size: 11px; line-height: 1.7; }
.hd-auth-note .ui-icon { width: 16px; margin-top: 1px; }
.hd-user-download { font-size: 11px; }
.hd-auth-footer { font-size: 11px; color: var(--hd-muted); padding-top: 20px; }
html[data-theme="dark"] .hd-auth-story { background: #283d2a; color: #e2ecd9; }
html[data-theme="dark"] .hd-auth-story > p,
html[data-theme="dark"] .hd-auth-story :is(.hd-eyebrow, .hd-auth-security) { color: #bccdb1; }
html[data-theme="dark"] .hd-auth-story :is(h1 em, .hd-auth-security strong) { color: #d5e6c3; }
/* Shared navigation: new class names avoid the legacy sidebar overrides. */
.hd-workspace { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100dvh; }
.hd-sidebar { --hd-surface: #143d2e; --hd-soft: #254e3c; --hd-ink: #edf6ed; --hd-muted: #bed0c3; --hd-green: #e1efcf; --hd-line: #375b47; --hd-accent: #365c41; --hd-focus: #c2dca8; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 27px 18px 16px; border-right: 1px solid var(--hd-line); background: var(--hd-surface); color: var(--hd-ink); min-width: 0; overflow-y: auto; z-index: 1050; }
.hd-sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; }
.hd-workspace-label { font-size: 10px; color: var(--hd-muted); text-transform: uppercase; letter-spacing: .12em; padding: 0 15px; margin: 37px 0 12px; }
.hd-nav { display: grid; gap: 5px; }
.hd-nav-link { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 10px 13px; border-radius: 9px; color: var(--hd-muted); font-size: 14px; font-weight: 550; }
.hd-nav-link .ui-icon { width: 19px; height: 19px; }
.hd-nav-link:hover { background: var(--hd-soft); color: var(--hd-green); }
.hd-nav-link.is-current { background: #e5edcf; color: #21452f; font-weight: 750; box-shadow: 0 3px 8px #08231820; }
.hd-sidebar-bottom { margin-top: auto; padding-top: 42px; }
.hd-account { display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--hd-line); padding: 20px 3px 0; margin-top: 15px; }
.hd-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; color: var(--hd-green); background: var(--hd-accent); border-radius: 50%; font-size: 11px; font-weight: 800; }
.hd-account > div { min-width: 0; flex: 1; }
.hd-account strong, .hd-account > div > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-account strong { font-size: 11px; color: var(--hd-ink); }
.hd-account > div > span { font-size: 10px; color: var(--hd-muted); }
.hd-account .hd-icon-button { width: 30px; height: 34px; border: 0; background: transparent; }
.hd-account .ui-icon { width: 18px; }
.hd-main { min-width: 0; display: flex; flex-direction: column; }
.hd-topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--hd-line); padding: 19px 36px; background: var(--hd-surface); min-height: 88px; }
.hd-topbar-title, .hd-topbar-actions { display: flex; align-items: center; gap: 15px; min-width: 0; }
.hd-topbar-actions { margin-left: auto; flex-wrap: wrap; max-width: 100%; }
.hd-topbar-actions > form { min-width: 0; }
.hd-workspace-page .herbal-confirm-modal:not(.show) { display: none; }
.herbal-confirm-modal[data-confirm-tone="neutral"] .herbal-confirm-submit { background: #174f39 !important; border-color: #174f39 !important; color: #fff !important; }
.hd-workspace-page .herbal-confirm-card { background: var(--hd-surface); color: var(--hd-ink); border: 1px solid var(--hd-line); border-radius: 14px; }
.hd-workspace-page .herbal-confirm-card :is(.modal-header, .modal-footer) { border-color: var(--hd-line); }
.hd-workspace-page .herbal-confirm-card .modal-header { gap: 14px; }
.hd-workspace-page .herbal-confirm-card .modal-header > div:nth-child(2) { flex: 1; }
.hd-workspace-page .herbal-confirm-card .modal-body p { margin: 0; font-size: 14px; }
.hd-workspace-page .herbal-confirm-card .flora-modal-eyebrow { color: var(--hd-muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.hd-workspace-page .herbal-confirm-card :is(.herbal-confirm-cancel, .herbal-confirm-submit) { min-height: 44px; padding: 10px 18px; font-size: 13px; border-radius: 8px; }
.hd-workspace-page .herbal-confirm-cancel { color: var(--hd-ink); background: var(--hd-soft); border-color: var(--hd-line); }
.hd-workspace-page .herbal-confirm-submit { color: #fff; background: #a43d30; }
html[data-theme="dark"] .hd-workspace-page .btn-close { filter: invert(1); }
.hd-topbar-title h1 { color: var(--hd-ink); font-size: 19px; line-height: 1.3; font-weight: 700; letter-spacing: -.4px; margin: 1px 0 0; overflow-wrap: anywhere; }
.hd-topbar-kicker { color: var(--hd-muted); font-size: 10px; letter-spacing: .04em; }
.hd-date { font-size: 11px; color: var(--hd-muted); }
.hd-menu-toggle, .hd-sidebar-close { display: none; }
.hd-content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 30px 36px; flex: 1; min-width: 0; }
.hd-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 20px 36px; font-size: 10px; color: var(--hd-muted); }
.hd-footer > span:first-child { font-weight: 650; }
.hd-footer > span:first-child > span { margin: 0 8px; color: var(--hd-line); }
/* Dashboard: task-focused cards with readable type and real database values. */
.hd-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.hd-dashboard-search { display: flex; align-items: center; gap: 10px; width: clamp(200px, 25vw, 350px); max-width: 100%; padding: 0 7px 0 13px; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--hd-bg); }
.hd-dashboard-search:focus-within { outline: 2px solid var(--hd-focus); outline-offset: 2px; }
.hd-dashboard-search > .ui-icon { width: 18px; color: var(--hd-muted); }
.hd-dashboard-search input { width: 100%; min-width: 0; height: 42px; border: 0; padding: 0; background: transparent; color: var(--hd-ink); font: inherit; font-size: .8rem; outline: none; }
.hd-dashboard-search input::placeholder { color: var(--hd-muted); opacity: 1; }
.hd-dashboard-search button { display: grid; place-items: center; flex: 0 0 36px; min-height: 36px; padding: 4px; border: 0; border-radius: 7px; background: var(--hd-surface); color: var(--hd-green); }
.hd-dashboard { display: grid; gap: 24px; font-size: .875rem; }
.hd-dashboard :is(a, button, p, h2, dt, dd) { overflow-wrap: anywhere; }
.hd-welcome { display: flex; align-items: center; justify-content: space-between; position: relative; gap: 28px; padding: 30px 34px; border: 1px solid #255c43; border-radius: 20px; background: #174f39; color: #fff; }
.hd-welcome-copy { min-width: 0; }
.hd-welcome .hd-eyebrow { color: #c7dcb8; font-size: .65rem; }
.hd-welcome h2 { max-width: 640px; margin: 11px 0 12px; color: #fff; font-size: clamp(1.65rem, 2.4vw, 2.1rem); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; text-wrap: balance; }
.hd-welcome p { max-width: 505px; font-size: .85rem; line-height: 1.7; color: #d8e7db; }
.hd-welcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin-top: 22px; }
.hd-welcome .hd-button { font-size: .78rem; }
.hd-welcome-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: #e4efdf; font-size: .8rem; font-weight: 600; }
.hd-welcome-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.hd-welcome-link .ui-icon { width: 16px; }
.hd-welcome-aside { display: grid; justify-items: end; flex: 0 1 250px; gap: 6px; text-align: right; }
.hd-welcome-aside time { color: #edf5e9; font-size: .75rem; font-weight: 600; }
.hd-welcome-aside > span:last-child { max-width: 210px; color: #d8e7db; font-size: .7rem; }
.hd-welcome-emblem { display: grid; place-items: center; width: 62px; height: 62px; border: 1px solid #699175; background: #2c6149; border-radius: 20px; margin-bottom: 12px; transform: rotate(-8deg); }
.hd-welcome-emblem .ui-icon { width: 34px; height: 34px; color: #dfedca; }
.hd-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.hd-metric { display: flex; flex-direction: column; min-width: 0; padding: 20px 22px; border: 1px solid var(--hd-line); border-radius: 15px; background: var(--hd-surface); color: var(--hd-ink); box-shadow: 0 3px 12px #173c2403; transition: border-color .15s, transform .15s; }
.hd-metric:hover { color: var(--hd-ink); border-color: var(--hd-focus); transform: translateY(-2px); }
.hd-metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.hd-metric-top > .ui-icon { width: 16px; height: 16px; color: var(--hd-muted); }
.hd-metric-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; }
.hd-metric-icon .ui-icon { width: 20px; height: 20px; }
.hd-tone-green { color: #245b3b; background: #e9f3e7; }
.hd-tone-sage { color: #596625; background: #f0f2dd; }
.hd-tone-blue { color: #34647a; background: #e9f1f6; }
.hd-tone-amber { color: #805d24; background: #faf0df; }
.hd-metric-label { color: var(--hd-muted); font-size: .8rem; font-weight: 550; }
.hd-metric > strong { display: block; margin: 3px 0 9px; font-size: 2.1rem; font-weight: 700; line-height: 1.3; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hd-metric > .hd-muted { display: block; margin-top: auto; font-size: .7rem; line-height: 1.6; }
.hd-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.hd-dashboard-column { display: grid; align-content: start; gap: 24px; min-width: 0; }
.hd-panel { min-width: 0; padding: 23px; border: 1px solid var(--hd-line); border-radius: 16px; background: var(--hd-surface); box-shadow: 0 3px 12px #173c2403; }
.hd-panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.hd-panel-heading > div { min-width: 0; }
.hd-panel h2 { color: var(--hd-ink); font-size: 1rem; font-weight: 700; line-height: 1.4; letter-spacing: -.025em; }
.hd-panel-heading .hd-eyebrow { margin-bottom: 6px; font-size: .6rem; }
.hd-panel-heading .hd-text-link { font-size: .75rem; }
.hd-panel > .hd-muted { color: var(--hd-muted); font-size: .8rem; line-height: 1.8; }
.hd-dashboard .hd-text-link { min-height: 36px; }
.hd-collection-caption { display: flex; justify-content: space-between; gap: 20px; padding: 10px 23px; margin: 0 -23px; background: var(--hd-soft); color: var(--hd-muted); font-size: .65rem; font-weight: 650; }
.hd-collection-caption > span:last-child { margin-right: 26px; }
.hd-plant-list { margin: 0 -23px; }
.hd-plant-row { display: flex; align-items: center; gap: 13px; padding: 15px 23px; border-bottom: 1px solid var(--hd-line); color: var(--hd-ink); }
.hd-plant-row:hover { color: var(--hd-green); background: var(--hd-soft); }
.hd-plant-image { position: relative; width: 48px; height: 48px; flex: 0 0 48px; border: 1px solid var(--hd-line); border-radius: 12px; background: var(--hd-soft); overflow: hidden; }
.hd-plant-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hd-image-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--hd-muted); }
.hd-plant-name { flex: 1; min-width: 0; }
.hd-plant-name strong, .hd-plant-name i { display: block; overflow-wrap: anywhere; }
.hd-plant-name strong { font-size: .85rem; font-weight: 650; }
.hd-plant-name i { margin-top: 2px; font-family: Georgia, serif; font-size: .75rem; color: var(--hd-muted); }
.hd-record-status { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 9px; border-radius: 20px; background: #edf5e9; color: #38613a; font-size: .65rem; font-weight: 600; }
.hd-record-status > span { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; }
.hd-record-status.is-inactive { background: var(--hd-soft); color: var(--hd-muted); }
.hd-plant-row > .ui-icon { width: 14px; height: 14px; color: var(--hd-muted); transform: rotate(-90deg); }
.hd-panel-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding-top: 15px; }
.hd-panel-bottom .hd-muted, .hd-panel-bottom .hd-text-link { font-size: .7rem; }
.hd-coverage { color: var(--hd-green); font-size: 2.15rem; font-weight: 650; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hd-coverage > span { font-size: 1.2rem; margin-left: 2px; }
.hd-progress { height: 9px; margin: 22px 0; border-radius: 8px; background: var(--hd-soft); overflow: hidden; }
.hd-progress > span { display: block; height: 100%; background: #6a8b47; border-radius: inherit; }
.hd-quality-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding-bottom: 20px; border-bottom: 1px solid var(--hd-line); }
.hd-quality-counts > div { min-width: 0; }
.hd-quality-counts dt { display: flex; align-items: baseline; gap: 5px; font-size: .7rem; font-weight: 500; color: var(--hd-muted); }
.hd-quality-counts dd { margin: 6px 0 0 11px; font-size: 1.35rem; font-weight: 650; line-height: 1.4; }
.hd-quality-dot { display: inline-block; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: #6a8b47; }
.hd-quality-dot.is-review { background: #c29a42; }
.hd-quality-dot.is-inactive { background: #8f9a91; }
.hd-fine-print { margin-top: 16px !important; font-size: .7rem; line-height: 1.75; color: var(--hd-muted); }
.hd-panel-title-icon { display: flex; align-items: center; gap: 10px; }
.hd-panel-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; background: var(--hd-soft); color: var(--hd-green); }
.hd-panel-icon .ui-icon { width: 19px; height: 19px; }
.hd-status { display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; border: 1px solid var(--hd-line); border-radius: 20px; padding: 4px 9px; background: var(--hd-soft); color: var(--hd-muted); font-size: .65rem; font-weight: 650; text-align: center; }
.hd-status-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: currentColor; }
.hd-status-complete { color: #326229; background: #edf6e3; border-color: #ccdfb9; }
.hd-status-failed { color: #8b3428; background: #fff0ec; border-color: #ecc9bf; }
.hd-status-running, .hd-status-queued { color: #715220; background: #fff6df; border-color: #e6d4ac; }
.hd-training-message { margin: 18px 0; padding: 13px 15px; border: 1px solid var(--hd-line); border-left: 3px solid #8da675; border-radius: 8px; background: var(--hd-soft); color: var(--hd-ink); font-size: .78rem; line-height: 1.75; overflow-wrap: anywhere; }
.hd-training-panel:has(.hd-status-failed) .hd-training-message { border-left-color: #bc6152; }
.hd-training-actions { display: flex; align-items: center; gap: 10px; }
.hd-training-actions form { flex: 1; min-width: 0; margin: 0; }
.hd-training-actions .hd-button { width: 100%; font-size: .8rem; }
.hd-training-actions .hd-icon-button { width: 44px; height: 44px; flex-basis: 44px; }
.hd-training-details { margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--hd-line); font-size: .75rem; color: var(--hd-muted); }
.hd-training-details summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; list-style: none; font-weight: 600; cursor: pointer; }
.hd-training-details summary::-webkit-details-marker { display: none; }
.hd-training-details summary .ui-icon { width: 14px; height: 14px; }
.hd-training-details[open] summary .ui-icon { transform: rotate(180deg); }
.hd-training-details > div { display: grid; gap: 10px; padding-top: 13px; }
.hd-training-details code { display: block; color: var(--hd-ink); overflow-wrap: anywhere; font-size: .7rem; }
.hd-release-panel { background: var(--hd-soft); }
.hd-release-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.hd-release-heading > .hd-panel-icon { background: var(--hd-surface); }
.hd-release-heading > .hd-eyebrow { font-size: .6rem; }
.hd-release-panel > h2 { margin-bottom: 12px; color: var(--hd-ink); font-size: 1.4rem; font-weight: 650; line-height: 1.25; letter-spacing: -.035em; }
.hd-release-steps { display: grid; gap: 13px; margin: 21px 0; padding: 0; list-style: none; counter-reset: release; color: var(--hd-ink); font-size: .75rem; }
.hd-release-steps li { display: flex; align-items: center; gap: 10px; counter-increment: release; }
.hd-release-steps li::before { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border: 1px solid var(--hd-line); border-radius: 50%; background: var(--hd-surface); content: counter(release); font-size: .65rem; }
.hd-release-panel > .hd-button { width: 100%; justify-content: space-between; font-size: .8rem; }
.hd-release-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 17px !important; font-size: .67rem; color: var(--hd-muted); line-height: 1.8; }
.hd-release-note .ui-icon { width: 15px; height: 15px; margin-top: 2px; }
.hd-empty-state { padding: 35px 23px; color: var(--hd-muted); text-align: center; }
.hd-empty-state .ui-icon { width: 30px; height: 30px; margin-bottom: 12px; }
.hd-empty-state strong { display: block; font-size: .9rem; }
.hd-empty-state p { margin-top: 10px; font-size: .8rem; }
.hd-shortcuts { margin-top: 2px; }
.hd-shortcuts-heading { margin-bottom: 16px; }
.hd-shortcuts-heading h2 { font-size: 1rem; font-weight: 700; color: var(--hd-ink); letter-spacing: -.025em; }
.hd-shortcuts-heading p { margin-top: 4px; font-size: .78rem; color: var(--hd-muted); }
.hd-shortcut-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hd-shortcut { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 18px; border: 1px solid var(--hd-line); border-radius: 13px; background: var(--hd-surface); color: var(--hd-ink); }
.hd-shortcut:hover { color: var(--hd-green); border-color: var(--hd-focus); }
.hd-shortcut > span:nth-child(2) { flex: 1; min-width: 0; }
.hd-shortcut strong, .hd-shortcut > span > span { display: block; }
.hd-shortcut strong { font-size: .78rem; font-weight: 650; }
.hd-shortcut > span > span { margin-top: 4px; font-size: .68rem; color: var(--hd-muted); line-height: 1.7; }
.hd-shortcut > .ui-icon { width: 16px; height: 16px; }
html[data-theme="dark"] .hd-tone-green { color: #c8e3b8; background: #304a32; }
html[data-theme="dark"] .hd-tone-sage { color: #dbe0a8; background: #41452c; }
html[data-theme="dark"] .hd-tone-blue { color: #b8d8ee; background: #293f4a; }
html[data-theme="dark"] .hd-tone-amber { color: #eed0a4; background: #493c26; }
html[data-theme="dark"] .hd-record-status { color: #c6e3b7; background: #304730; }
html[data-theme="dark"] .hd-record-status.is-inactive { color: var(--hd-muted); background: var(--hd-soft); }
html[data-theme="dark"] .hd-status { color: var(--hd-ink); background: var(--hd-soft); border-color: var(--hd-line); }
html[data-theme="dark"] .hd-status-complete { color: #c4e6b3; background: #2d4229; border-color: #49603e; }
html[data-theme="dark"] .hd-status-failed { color: #ffcabd; background: #422d28; border-color: #775045; }
html[data-theme="dark"] :is(.hd-status-running, .hd-status-queued) { color: #f4d7a4; background: #473b25; border-color: #74603b; }
/* Narrow screens and zoom. Keep every action reachable without horizontal scroll. */
@media (min-width: 993px) {
  .hd-workspace-page.hd-nav-collapsed .hd-workspace { grid-template-columns: minmax(0, 1fr); }
  .hd-workspace-page.hd-nav-collapsed .hd-sidebar { display: none; }
  .hd-menu-toggle { display: inline-flex; }
}
@media (max-width: 1200px) {
  .hd-topbar { padding: 18px 25px; }
  .hd-content { padding: 25px; }
  .hd-welcome-aside { display: none; }
  .hd-metrics { gap: 12px; }
  .hd-metric { padding: 16px; }
  .hd-dashboard-grid, .hd-dashboard-column { gap: 18px; }
  .hd-panel { padding: 20px; }
  .hd-plant-list { margin-left: -20px; margin-right: -20px; }
  .hd-plant-row { padding-left: 20px; padding-right: 20px; }
  .hd-collection-caption { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .hd-shortcut-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 721px) and (max-width: 1120px) {
  .hd-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .hd-dashboard-grid > .hd-dashboard-column:last-child { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 992px) {
  .hd-workspace { grid-template-columns: minmax(0, 1fr); }
  .js .hd-sidebar { position: fixed; width: min(300px, calc(100vw - 32px)); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
  .hd-workspace-page.hd-nav-open { overflow: hidden; }
  .hd-nav-open .hd-sidebar { transform: translateX(0); visibility: visible; }
  .hd-sidebar-backdrop { position: fixed; inset: 0; background: #10241980; z-index: 1045; }
  .hd-menu-toggle, .hd-sidebar-close { display: inline-flex; }
  html:not(.js) .hd-sidebar { height: auto; position: static; }
  html:not(.js) .hd-sidebar .hd-sidebar-close { display: none; }
  html:not(.js) .hd-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-auth-story, .hd-auth-form-panel { padding: 32px; }
  .hd-auth-story h1 { font-size: 35px; }
}
@media (max-width: 720px) {
  .hd-auth-top { padding: 20px; }
  .hd-auth-main { padding: 8px 16px; }
  .hd-auth-card { display: block; max-width: 480px; border-radius: 16px; }
  .hd-auth-story { padding: 24px; }
  .hd-auth-story h1 { font-size: 29px; margin-top: 10px; }
  .hd-auth-story h1 br { display: none; }
  .hd-auth-story > p, .hd-auth-photo, .hd-auth-security { display: none; }
  .hd-auth-form-panel { padding: 28px 24px; }
  .hd-auth-lock { display: none; }
  .hd-auth-form-panel h2 { font-size: 28px; }
  .hd-auth-top-actions { gap: 12px; }
  .hd-auth-top-actions > a { font-size: 11px; }
  .hd-auth-top-actions > a .ui-icon { display: none; }
  .hd-auth-footer { padding: 23px 20px; max-width: 520px; }
  .hd-dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .hd-welcome { padding: 24px; gap: 18px; }
  .hd-welcome h2 { font-size: 27px; }
  .hd-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-topbar { padding: 15px 20px; gap: 10px; }
  .hd-topbar-title { gap: 10px; }
  .hd-topbar-actions { gap: 8px; }
  .hd-date { display: none; }
  .hd-content { padding: 20px; }
  .hd-footer { padding: 12px 20px 20px; }
}
@media (max-width: 600px) {
  .hd-topbar:has(.hd-dashboard-search) .hd-topbar-actions { width: 100%; margin-left: 0; }
  .hd-dashboard-search { width: auto; flex: 1; }
  .hd-metric { padding: 17px; }
  .hd-welcome { border-radius: 15px; }
  .hd-welcome h2 { font-size: 1.65rem; }
  .hd-quality-counts { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hd-quality-counts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
  .hd-quality-counts dd { margin: 0; font-size: 1.1rem; }
  .hd-plant-row { flex-wrap: wrap; }
  .hd-plant-name { flex-basis: calc(100% - 70px); }
  .hd-record-status { margin-left: 61px; }
  .hd-plant-row > .ui-icon { margin-left: auto; }
  .hd-collection-caption > span:last-child { display: none; }
}
@media (max-width: 380px) {
  .hd-brand { font-size: 21px; gap: 6px; }
  .hd-brand img { width: 30px; height: 30px; }
  .hd-auth-top { padding: 16px; gap: 8px; }
  .hd-auth-top-actions { gap: 7px; }
  .hd-auth-top-actions > a { font-size: 10px; }
  .hd-auth-story, .hd-auth-form-panel { padding: 23px 20px; }
  .hd-auth-story h1 { font-size: 26px; }
  .hd-auth-footer { font-size: 10px; gap: 8px; }
  .hd-content { padding: 16px 12px; }
  .hd-topbar { padding: 14px 12px; }
  .hd-topbar-title h1 { font-size: 16px; }
  .hd-topbar-title { gap: 8px; }
  .hd-topbar-actions > a { display: none; }
  .hd-panel { padding: 18px; }
  .hd-plant-list { margin: 0 -18px; }
  .hd-plant-row { padding: 13px 18px; gap: 10px; }
  .hd-record-status { display: inline-flex; margin-left: 58px; }
  .hd-panel-heading { gap: 8px; flex-wrap: wrap; }
  .hd-metric { padding: 14px; }
  .hd-metric-top { font-size: 10px; gap: 7px; }
  .hd-welcome { padding: 20px; }
  .hd-collection-caption { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .hd-auth-page *, .hd-workspace * { scroll-behavior: auto !important; transition: none !important; }
}
