:root {
    /* Clean, light theme. Neutrals are the original cool white/grey (no warm
       tint on the page or menu bars); colour comes only from the subtle sage
       selection and the faint per-kind card tints. */
    --bg: #f4f5f7;             /* light page (as it was) */
    --surface: #ffffff;        /* menu bars / cards — white */
    --soft: #f4f6f8;           /* table-header / soft fill */
    --card: #ffffff;
    --ink: #1d2330;
    --muted: #6b7280;
    --line: #e4e7ec;
    --brand: #8a6d3b;          /* gold — used only for the small "Admin" wordmark */
    --accent: #5f7a58;         /* muted sage — SELECTION + focus/hover accent */
    --accent-soft: rgba(95,122,88,.14);
    --sel-bg: #eaf0e6;         /* very soft sage tint for the selected nav item */
    --sel-ink: #4a6243;        /* darker sage for its text/icon */
    --primary: #1d2330;
    --primary-ink: #ffffff;
    --ok: #17803d;
    --ok-bg: #e6f4ea;
    --off: #9aa1ac;
    --danger: #b42318;
    --danger-bg: #fdeceb;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must beat display rules below (.modal, .login-wrap
   set display, which would otherwise override [hidden]'s display:none). */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.45;
}
#app-view { min-height: 100vh; display: flex; align-items: stretch; }

/* ---------- Buttons ---------- */
.btn {
    font: inherit;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    background: #fff;
    color: var(--ink);
    transition: background .12s, border-color .12s, opacity .12s;
    white-space: nowrap;
}
.btn:hover { background: #f0f1f3; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { opacity: .9; background: var(--primary); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: #fff; border-color: #cfd4dc; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #f2c4c0; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }

/* ---------- Brand ---------- */
.brand { font-weight: 700; letter-spacing: .3px; font-size: 18px; }
.brand span { color: var(--brand); font-weight: 600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
    background: var(--card); width: 100%; max-width: 360px; padding: 28px;
    border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 14px;
}
.login-card .brand { font-size: 22px; }
.login-sub { margin: -6px 0 4px; color: var(--muted); }
.login-step { display: flex; flex-direction: column; gap: 14px; }
.login-step[hidden] { display: none; }
.login-hint { margin: -8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-link { background: none; border: none; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 2px; text-align: center; }
.login-link:hover { text-decoration: underline; }
.login-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; }
.login-check input { width: auto; margin: 0; }
#twofa-code, #reset-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 6px; text-align: center; }

/* ---------- Sidebar nav (vertical on desktop, drawer on mobile) ---------- */
.sidebar {
    width: 238px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; }
.sidebar-x { display: none; background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.universe-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 10px; }
/* Tools of the ACTIVE universe, nested right under its name. */
.uni-tools { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 15px; padding-left: 7px; border-left: 2px solid var(--line); }
.uni-tools:empty { display: none; }
.uni-tools .nav-link { font-size: 13.5px; padding: 6px 10px; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.su-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; min-width: 0; }
.su-btn:hover { border-color: var(--accent); }
.su-btn #who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-btn .su-ico { flex: none; color: var(--muted); font-size: 13px; }
/* Account modal */
.acct-modal .acct-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acct-modal .acct-row:last-child { border-bottom: none; }
.acct-modal .acct-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.acct-modal .acct-val { font-size: 14.5px; color: var(--ink); }
.acct-modal .acct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Current-hotel indicator under the brand. */
.sidebar-hotel { margin: 4px 14px 12px; padding: 7px 12px; background: var(--sel-bg); border: 1px solid rgba(95,122,88,.28); border-radius: 10px; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s; }
.sidebar-hotel:hover { border-color: var(--accent); }
.sidebar-hotel .sh-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.sidebar-hotel .sh-pick { position: relative; display: flex; align-items: center; }
.sidebar-hotel .sh-btn {
    -webkit-appearance: none; appearance: none; width: 100%; margin: 0; padding: 1px 22px 1px 0;
    border: none; background: transparent; font: inherit; font-size: 14.5px; font-weight: 700; color: var(--sel-ink); cursor: pointer;
    display: flex; align-items: center; text-align: left;
}
.sidebar-hotel .sh-btn:focus { outline: none; box-shadow: none; }
.sidebar-hotel .sh-btn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-hotel .sh-static { font-size: 14.5px; font-weight: 700; color: var(--sel-ink); }
.sidebar-hotel .sh-caret { position: absolute; right: 2px; pointer-events: none; color: var(--accent); font-size: 10px; transition: transform .14s; }
.sidebar-hotel .sh-btn[aria-expanded="true"] .sh-caret { transform: rotate(180deg); }
/* Custom (themed) option list — a native <select> popup can't be styled. */
.sidebar-hotel .sh-menu {
    position: absolute; top: calc(100% + 6px); left: -4px; right: -4px; z-index: 50;
    margin: 0; padding: 4px; list-style: none;
    background: var(--card); border: 1px solid rgba(95,122,88,.28); border-radius: 10px;
    box-shadow: 0 10px 26px rgba(0,0,0,.16); max-height: 260px; overflow-y: auto;
}
.sidebar-hotel .sh-opt {
    padding: 8px 10px; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--ink);
    cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-hotel .sh-opt:hover { background: var(--sel-bg); }
.sidebar-hotel .sh-opt.is-sel { background: var(--accent); color: #fff; }
/* A tool's own hotel selector, locked to the master picker in the sidebar. */
select.hotel-locked { background: var(--soft); color: var(--muted); cursor: not-allowed; opacity: .9; }
.sidebar-foot-btns { display: flex; gap: 8px; }
.sidebar-foot-btns .btn { flex: 1; }

.nav-link {
    display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0;
    padding: 8px 11px; border-radius: 8px; text-decoration: none;
    color: var(--muted); font-weight: 600; font-size: 14px; border: 1px solid transparent;
    cursor: pointer; background: none;
}
/* Never let a long label push a horizontal scrollbar — clip with an ellipsis. */
.nav-link > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-ico { flex: none; }
.nav-link:hover { background: #f0f1f3; color: var(--ink); }
.nav-link.active { background: var(--sel-bg); color: var(--sel-ink); }
.nav-link.active:hover { background: var(--sel-bg); color: var(--sel-ink); }
/* Monochrome line-icon set (public/core/icons.js). stroke = currentColor, so
   each icon follows the nav text colour: muted idle, ink on hover, sage active. */
.nav-ico { display: inline-flex; align-items: center; }
.nav-ico svg { width: 17px; height: 17px; }
.mono-ico { display: inline-flex; align-items: center; vertical-align: -.12em; }
.mono-ico svg { width: 1em; height: 1em; }
.who { color: var(--muted); font-size: 13px; }

/* Main column (to the right of the sidebar). */
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.mobile-bar { display: none; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.hamburger { background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; line-height: 1; padding: 5px 11px; cursor: pointer; color: var(--ink); }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 60; }

/* Below the desktop width the sidebar becomes a slide-in drawer. */
@media (max-width: 900px) {
    #app-view { display: block; }
    .sidebar {
        position: fixed; left: 0; top: 0; height: 100vh; height: 100dvh; width: 264px; z-index: 70;
        transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow);
    }
    .sidebar.open { transform: none; }
    .sidebar-x { display: block; }
    .mobile-bar { display: flex; }
    .app-main { min-height: 100vh; }
}

/* ---------- Layout ---------- */
.container { max-width: 1080px; width: 100%; margin: 0 auto; padding: 22px 20px 48px; flex: 1; }
.site-footer {
    border-top: 1px solid var(--line); background: var(--card);
    padding: 14px 20px; color: var(--muted); font-size: 13px; text-align: center;
}

/* ---------- Universe home (tool picker) ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.home-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--card);
    border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink);
    box-shadow: var(--shadow); transition: border-color .12s, transform .06s; }
.home-card:hover { transform: translateY(-2px); box-shadow: 0 2px 6px rgba(16,24,40,.07), 0 14px 32px rgba(16,24,40,.12); }
/* Cards stay plain white; only the tool ICON carries colour, per kind
   (settings = blue, generate = green, action = violet). Top-bar icons stay
   monochrome (they follow the nav text colour). */
.home-card.kind-settings .home-ico { color: #3f6fd0; }
.home-card.kind-generate .home-ico { color: #2e9e5b; }
.home-card.kind-action .home-ico { color: #7b4bcc; }
.home-section { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 26px 2px 12px; padding-top: 4px; border-top: 1px solid var(--line); }
.home-section:first-of-type { }
.subbar-div { display: block; height: 1px; background: var(--line); margin: 8px 8px; }
.home-ico { flex: none; display: inline-flex; }
.home-ico svg { width: 26px; height: 26px; }
.home-card-title { font-weight: 700; font-size: 16px; }
.home-card-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- Tool header / toolbar ---------- */
.tool-head { margin-bottom: 16px; }
.tool-head h1 { margin: 0 0 2px; font-size: 22px; }
.tool-head p { margin: 0; color: var(--muted); font-size: 14px; }
.toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 16px 0; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.count { color: var(--muted); font-size: 14px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.inline select, .inline input { min-width: 170px; }

/* ---------- Multi-select checkbox dropdown (tool filters) ---------- */
.msel { position: relative; display: inline-block; }
.msel-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 230px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.msel-btn:hover { border-color: var(--accent); }
.msel-lbl { color: var(--muted); white-space: nowrap; }
.msel-cur { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.msel-caret { color: var(--muted); font-size: 10px; margin-left: 2px; }
.msel.msel-on .msel-btn { border-color: var(--accent); background: var(--accent-soft); }
.msel-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 210px; max-width: calc(100vw - 40px); max-height: 320px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.msel-tools { display: flex; justify-content: flex-end; padding: 2px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.msel-clear { background: none; border: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.msel-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 14px; font-weight: 400; cursor: pointer; }
.msel-opt:hover { background: var(--soft); }
.msel-opt input { width: auto; min-width: 0; margin: 0; }
.msel-opt span { flex: 1; }
.msel-empty { padding: 8px; color: var(--muted); text-align: center; }
.msel-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: 13px; font-weight: 600; }
.msel-chip-x { background: none; border: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.msel-chip-x:hover { color: var(--ink); }

/* ---------- Settings-form panels (Admin ▸ Email, Integrations, …) ----------
   Shared because more than one tool uses them; a tool-local view.css is only
   loaded while that tool is open, so anything reused must live here. */
.settings-panel { padding: 18px; margin-bottom: 16px; }
.settings-panel form > label, .settings-panel > label { margin-bottom: 12px; display: block; }
.settings-h { margin: 4px 0 12px; font-size: 14px; }
.settings-h:not(:first-child) { margin-top: 20px; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.settings-actions input[type=email], .settings-actions input[type=text] { width: auto; min-width: 240px; margin-top: 0; }

/* CSV import result */
.csv-imp { display: flex; flex-direction: column; gap: 12px; }
.csv-ok { color: var(--accent); font-weight: 600; margin: 4px 0 0; }
.csv-bad { color: #b23b3b; font-weight: 600; margin: 8px 0 4px; }
.csv-errs { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; max-height: 220px; overflow-y: auto; }

/* Error log detail */
.el-detail { display: flex; flex-direction: column; gap: 10px; }
.el-detail .tkv-cell { }
.el-stack { background: #1d2330; color: #e6e8ec; border-radius: 8px; padding: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; margin: 4px 0 0; }

/* Preventive "due today" heads-up on the maintenance dashboard */
.pm-banner { background: #fff8e6; border: 1px solid #e6c34d; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.pm-banner-h { font-weight: 700; color: #8a6d1a; margin-bottom: 6px; }
.pm-banner-list { margin: 0 0 8px; padding-left: 20px; color: var(--ink); font-size: 14px; line-height: 1.6; }

/* clickable analytics chart rows / slices (drill-through to Tickets) */
.mbar-row.is-link, .pie-leg.is-link { cursor: pointer; border-radius: 6px; }
.mbar-row.is-link:hover, .pie-leg.is-link:hover { background: var(--accent-soft); }
.mkpi.is-link { cursor: pointer; }
.mkpi.is-link:hover { border-color: var(--accent); }
.pie-svg .pie-slice { cursor: pointer; }
.pie-svg .pie-slice:hover { opacity: .82; }

/* ---------- Forms ---------- */
label { display: block; font-size: 14px; font-weight: 500; }
label small { font-weight: 400; color: var(--muted); margin-left: 4px; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search],
input[type=time], input[type=email], input[type=url], input[type=tel], input[type=month], input[type=color],
select, textarea {
    width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line);
    border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
    box-sizing: border-box; min-width: 0;
}
/* Date/time controls have a browser minimum width that overflows narrow
   containers (esp. mobile) — cap them to the container. */
input[type=date], input[type=time] { max-width: 100%; }
/* iOS Safari renders date/time as a native control that ignores width and adds
   an internal margin to the value, so it sits a few px wider than its box.
   Scoped to iOS (desktop keeps its native picker). */
@supports (-webkit-touch-callout: none) {
    input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; min-height: 40px; }
    input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; margin: 0; }

.form-error { background: var(--danger-bg); color: var(--danger); padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.form-ok { background: var(--ok-bg); color: var(--ok); padding: 8px 10px; border-radius: 8px; font-size: 14px; }

/* ---------- Table ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }

/* Standardized "API — for other tools" panel (AdminShell.apiDoc). Shared by
   every tool that documents a public API, so they all look identical. */
.api-doc { margin-top: 18px; padding: 16px 18px; }
.api-doc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.api-doc-head .rg-h2 { margin: 0; font-size: 15px; }
.api-doc-badge { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--sel-ink); background: var(--sel-bg); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.api-doc .hint { margin: 4px 0 12px; }
.api-doc-table td, .api-doc-table th { vertical-align: middle; }
.api-ep { display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.api-ep-try { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.api-ep-try:hover { text-decoration: underline; }
.api-doc-note { margin: 10px 0 0; color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* Small "remove row" button (used by editable tables). */
.rg-x { border: none; background: #f0f1f3; color: var(--danger); width: 32px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 17px; flex: none; line-height: 1; }
.rg-x:hover { background: var(--danger-bg); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }
.actions-col { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Status pill / toggle (shared: active/inactive) ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; user-select: none; }
.pill-on { background: var(--ok-bg); color: var(--ok); }
.pill-off { background: #eef0f3; color: var(--off); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------------------------------------------------------------------------
   Maintenance (CMMS) — shared classes across every tool in the universe.
--------------------------------------------------------------------------- */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sel-bg); color: var(--sel-ink); white-space: nowrap; }
.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.viewtoggle .vt { border: none; background: transparent; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.viewtoggle .vt + .vt { border-left: 1px solid var(--line); }
.viewtoggle .vt.on { background: var(--accent); color: #fff; }
tr.mrow { cursor: pointer; }
tr.mrow:hover { background: var(--soft); }
.mtk { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.mtk-open { background: #dbeafe; color: #1e40af; }
.mtk-in_progress { background: #fef3c7; color: #92400e; }
.mtk-on_hold { background: #e5e7eb; color: #374151; }
.mtk-resolved { background: #dcfce7; color: #166534; }
.mtk-closed { background: #e5e7eb; color: #4b5563; }
.mtk-danger { background: #fee2e2; color: #991b1b; }
/* Audit filter bar: keep every filter on one line instead of full-width rows. */
.mau-filters { gap: 10px; }
.mau-filters .inline { gap: 6px; }
.mau-filters .inline select { min-width: 120px; }
.mau-filters .inline input[type=date] { min-width: 0; width: auto; }
.mau-filters input[type=search] { width: auto; min-width: 130px; max-width: 180px; margin-top: 0; }
.mpri { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.mpri-low { background: #eef2f6; color: #64748b; }
.mpri-medium { background: #dbeafe; color: #1e40af; }
.mpri-high { background: #ffedd5; color: #9a3412; }
.mpri-urgent { background: #fee2e2; color: #991b1b; }
.mdetail-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.mdetail-h { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 18px 0 8px; }
/* Ticket photo attachments */
.mt-photos .mt-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mt-thumb { position: relative; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; background: var(--soft); }
.mt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mt-thumb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.mt-addphoto { display: inline-block; cursor: pointer; }
.mt-addphoto .btn { display: inline-flex; align-items: center; }
.mt-imgstatus { margin-left: 10px; font-size: 12.5px; color: var(--muted); }
.mt-lightbox { display: grid; place-items: center; }
.mt-lightbox img { max-width: 100%; max-height: 80vh; border-radius: 8px; }
.cm-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--sel-bg); color: var(--sel-ink); vertical-align: middle; }
/* Ticket view (read-only) */
.tkv-title { margin: 0 0 8px; font-size: 18px; }
.tkv-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tkv-desc { margin: 0 0 12px; white-space: pre-wrap; }
.tkv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 12px; }
.tkv-cell { min-width: 0; }
.tkv-cellval { font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.tkv-res { margin-bottom: 12px; }
.tkv-res p { margin: 3px 0 0; white-space: pre-wrap; }
/* Comments */
.cm-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cm-item { background: var(--soft); border-radius: 8px; padding: 8px 30px 8px 10px; font-size: 13.5px; position: relative; }
.cm-item.cm-auto { background: transparent; border-left: 2px solid var(--line); border-radius: 0; padding: 4px 30px 4px 10px; color: var(--muted); font-size: 12.5px; }
.cm-when { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.cm-chg { font-weight: 600; color: var(--ink); }
.cm-body { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-del { position: absolute; top: 6px; right: 6px; border: none; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.cm-add { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.cm-add textarea { margin-top: 0; }
@media (max-width: 720px) { .tkv-grid { grid-template-columns: 1fr; } }
.mkpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.mkpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.mkpi-val { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.mkpi-lbl { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.mkpi.is-warn .mkpi-val { color: #b45309; }
.mkpi.is-bad .mkpi-val { color: #b42318; }
.mchart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mchart-grid + .mchart-grid { margin-top: 16px; }
.mchart { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.mchart h3 { margin: 0 0 12px; font-size: 14px; }
.mchart-wide { grid-column: 1 / -1; }
.col-wrap { width: 100%; overflow-x: auto; }
.col-svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; }
.col-axis { stroke: var(--line); stroke-width: 1; }
.col-val { font-size: 8px; fill: var(--muted); }
.col-cat { font-size: 9px; fill: var(--muted); text-transform: capitalize; }
.col-legend { justify-content: center; margin-top: 8px; }
.mbar-row { display: grid; grid-template-columns: 140px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 8px; }
.mbar-lbl { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbar-track { background: var(--soft); border-radius: 6px; height: 16px; overflow: hidden; }
.mbar-fill { height: 100%; border-radius: 6px; background: var(--accent); min-width: 2px; }
.mbar-val { font-size: 12.5px; font-weight: 700; text-align: right; color: var(--ink); }
.pie-wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.pie-svg { width: 110px; height: 110px; flex: none; }
.pie-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 130px; }
.pie-leg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.pie-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pie-leg-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.pie-leg-val { color: var(--muted); white-space: nowrap; }
.mcal-head { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 4px 0 12px; }
.mcal-title { font-size: 15px; text-transform: capitalize; min-width: 170px; text-align: center; }
.mcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mcal-wd { margin-bottom: 6px; }
.mcal-wdh { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.mcal-cell { min-height: 84px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; background: var(--card); }
.mcal-empty { border: none; background: transparent; }
.mcal-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mcal-day { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.mcal-today .mcal-day { color: var(--accent); }
.mcal-item { display: block; width: 100%; text-align: left; border: none; border-radius: 5px; padding: 2px 6px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--sel-bg); color: var(--sel-ink); border-left: 3px solid var(--accent); }
.mcal-item.is-over { background: #fee2e2; color: #991b1b; border-left-color: #dc2626; }
.mcal-more { font-size: 10.5px; color: var(--muted); padding-left: 4px; }
@media (max-width: 720px) { .mchart-grid { grid-template-columns: 1fr; } .mcal-cell { min-height: 58px; } }
@media (prefers-color-scheme: dark) {
    .mtk-open { background: #14306b; color: #bfdbfe; } .mtk-in_progress { background: #4a3707; color: #fde68a; }
    .mtk-on_hold { background: #374151; color: #e5e7eb; } .mtk-resolved { background: #0f3d22; color: #bbf7d0; } .mtk-closed { background: #374151; color: #cbd5e1; } .mtk-danger { background: #4c1616; color: #fecaca; }
    .mpri-low { background: #334155; color: #cbd5e1; } .mpri-medium { background: #14306b; color: #bfdbfe; } .mpri-high { background: #5a2c0c; color: #fed7aa; } .mpri-urgent { background: #4c1616; color: #fecaca; }
    .mcal-item.is-over { background: #4c1616; color: #fecaca; }
}

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: start center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal-card { background: var(--card); width: 100%; max-width: 720px; border-radius: 14px; box-shadow: var(--shadow); }
.modal-narrow { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; z-index: 80; }

/* ---- home dashboard ---- */
.nav-home { margin-right: 4px; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dash-head h1 { display: flex; align-items: center; gap: 9px; }
.dash-head p { color: var(--muted); margin-top: 3px; }
.dash-hotel { align-self: center; }
.dash-panel { padding: 16px 18px; margin-bottom: 16px; }
.dash-phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dash-phead h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0; }
.dash-phead .mono-ico svg { width: 18px; height: 18px; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dash-card { border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; background: var(--soft); display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
button.dash-card:hover { border-color: var(--accent); background: #fff; }
.dash-card .dash-card-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.dash-by { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.dash-date { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-rowbtns { display: flex; gap: 2px; }
.dash-ic { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 5px; border-radius: 6px; }
.dash-ic:hover { background: var(--line); color: var(--ink); }
.dash-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.dash-notes-scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.dash-notes { width: 100%; border-collapse: collapse; }
.dash-notes th { position: sticky; top: 0; background: var(--soft); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dash-notes td { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.dash-notes tbody tr:last-child td { border-bottom: none; }
.dash-notes .dash-ntitle { font-weight: 600; color: var(--ink); }
.dash-notes .dash-nopen { text-align: right; width: 1%; white-space: nowrap; }
.dash-read .dash-read-body { margin: 8px 0 4px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; }

/* home tabs: documentation / procedures / graphics */
.home-head-right { display: flex; align-items: center; gap: 10px; }
.doc-sec { padding: 16px 18px; margin-bottom: 14px; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.doc-head h2 { font-size: 15px; margin: 0; }
.doc-desc { line-height: 1.55; color: var(--ink); white-space: pre-wrap; }
.doc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.doc-list { display: flex; flex-direction: column; gap: 2px; }
.doc-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.doc-item:last-child { border-bottom: none; }
.doc-item-main { min-width: 0; font-size: 13.5px; }
.doc-item-main strong { color: var(--ink); }
.doc-item-main > span { color: var(--muted); margin-left: 8px; }
.doc-role { color: var(--muted); font-weight: 400; font-size: 12px; }
.doc-cmeta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.doc-cmeta a { color: var(--accent); }
.doc-item-actions { display: flex; gap: 2px; flex: none; }
.proc-list { padding: 6px 8px; }
.proc-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.proc-item:last-child { border-bottom: none; }
.proc-open { text-align: left; background: none; border: none; font: inherit; font-weight: 600; color: var(--ink); padding: 0; cursor: pointer; }
.proc-open:hover { color: var(--accent); }
.proc-read { line-height: 1.6; white-space: pre-wrap; color: var(--ink); }
.proc-dept { white-space: nowrap; }
.proc-emoji { margin-right: 6px; font-size: 15px; }
.proc-by { color: var(--muted); font-size: 13px; }
.proc-meta { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
.gfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.gfx-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.gfx-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--soft); display: block; }
.gfx-noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.gfx-body { padding: 10px 12px; position: relative; }
.gfx-title { font-weight: 600; color: var(--ink); }
.gfx-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.gfx-link { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--accent); }
.gfx-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; background: rgba(255,255,255,.85); border-radius: 6px; }
.am-photo { display: flex; gap: 14px; align-items: flex-start; }
@media (max-width: 820px) { .dash-cols, .doc-cols { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
}

/* Admin warning bar: outgoing email is failing */
.mailwarn { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 200; display: flex; align-items: center; gap: 12px;
    background: #fff8e6; border: 1px solid #e6c34d; color: #8a6d1a; border-radius: 10px; padding: 12px 14px;
    box-shadow: var(--shadow); font-size: 13.5px; font-weight: 600; }
.mailwarn span { flex: 1; }
.mailwarn-x { background: none; border: none; font-size: 20px; line-height: 1; color: #8a6d1a; cursor: pointer; padding: 0 4px; }
@media (max-width: 640px) { .mailwarn { flex-wrap: wrap; } }
