/* Pizza Twist Support — ops theme. Dense, quiet, red/black. This is a tool, not a brochure. */

:root {
    --pt-red: #c8102e;
    --pt-red-dark: #9b0c23;
    --pt-ink: #14161a;
    --pt-ink-2: #1e2127;
    --pt-line: #2b2f37;
    --pt-text: #e8eaed;
    --pt-text-dim: #9aa1ab;
    --pt-surface: #f7f8fa;
    --pt-card: #ffffff;
    --pt-card-line: #e3e6ea;
    --pt-sidebar-w: 216px;
    --pt-topbar-h: 52px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--pt-surface);
    color: #1d2129;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

body.pt-anon {
    background: var(--pt-ink);
    display: grid;
    place-items: center;
    min-height: 100vh;
}

/* ---------- sidebar ---------- */

.pt-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--pt-sidebar-w);
    background: var(--pt-ink);
    color: var(--pt-text);
    display: flex;
    flex-direction: column;
    padding: 14px 0 10px;
}

.pt-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 16px 16px;
}

.pt-brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--pt-red);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .5px;
}

.pt-brand-mark-lg { width: 46px; height: 46px; font-size: 17px; margin: 0 auto 12px; }
.pt-brand-text { font-weight: 600; letter-spacing: .2px; }

.pt-nav { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }

.pt-nav-heading {
    padding: 16px 16px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #6c7480;
}

.pt-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    color: #c4c9d0;
    text-decoration: none;
    border-left: 2px solid transparent;
}

.pt-nav-link:hover { background: var(--pt-ink-2); color: #fff; }
.pt-nav-link.active { background: var(--pt-ink-2); color: #fff; border-left-color: var(--pt-red); }
.pt-nav-pending { opacity: .42; cursor: default; }
.pt-ico { width: 16px; text-align: center; font-size: 12px; opacity: .85; }

.pt-nav-foot {
    padding: 10px 16px 0;
    border-top: 1px solid var(--pt-line);
    color: var(--pt-text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
}

/* ---------- topbar ---------- */

.pt-topbar {
    position: fixed;
    top: 0;
    left: var(--pt-sidebar-w);
    right: 0;
    height: var(--pt-topbar-h);
    background: var(--pt-card);
    border-bottom: 1px solid var(--pt-card-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    z-index: 10;
}

.pt-search { flex: 1; max-width: 420px; }
.pt-topbar-right { display: flex; align-items: center; gap: 8px; }

.pt-presence-btn, .pt-avatar-btn, .pt-bell {
    background: transparent;
    border: 1px solid var(--pt-card-line);
    display: flex;
    align-items: center;
    gap: 7px;
}

.pt-bell { position: relative; }

.pt-bell-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--pt-red);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
}

.pt-avatar {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--pt-ink);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.pt-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9aa1ab; }
.pt-dot-online { background: #2ea043; }
.pt-dot-busy { background: var(--pt-red); }
.pt-dot-away { background: #d29922; }
.pt-dot-onbreak { background: #a371f7; }
.pt-dot-inmeeting { background: #388bfd; }
.pt-dot-offline { background: #6c7480; }

/* ---------- main ---------- */

.pt-main { margin: var(--pt-topbar-h) 0 0 var(--pt-sidebar-w); padding: 20px 22px 40px; }
.pt-page-head { margin-bottom: 18px; }
.pt-page-head h1 { font-size: 20px; font-weight: 600; margin: 0 0 3px; }

.pt-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.pt-tile {
    background: var(--pt-card);
    border: 1px solid var(--pt-card-line);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pt-tile-muted { opacity: .55; }

.pt-tile-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6c7480;
}

.pt-tile-value { font-size: 20px; font-weight: 600; }

.pt-panel {
    background: var(--pt-card);
    border: 1px solid var(--pt-card-line);
    border-radius: 8px;
    padding: 16px 18px;
}

.pt-checklist { list-style: none; margin: 10px 0 0; padding: 0; }
.pt-checklist li { padding: 4px 0 4px 22px; position: relative; color: #6c7480; }
.pt-checklist li::before { content: "○"; position: absolute; left: 2px; }
.pt-checklist li.done { color: #1d2129; }
.pt-checklist li.done::before { content: "●"; color: #2ea043; }

/* ---------- login ---------- */

.pt-anon-main { width: 100%; padding: 24px; }

.pt-login-card {
    width: min(400px, 100%);
    margin: 0 auto;
    background: var(--pt-card);
    border-radius: 12px;
    padding: 28px 30px 22px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .38);
}

.pt-login-brand { text-align: center; margin-bottom: 20px; }
.pt-login-brand h1 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.pt-login-brand p { font-size: 13px; margin: 0; }

.pt-btn-primary { background: var(--pt-red); border-color: var(--pt-red); color: #fff; font-weight: 500; }
.pt-btn-primary:hover:not(:disabled) { background: var(--pt-red-dark); border-color: var(--pt-red-dark); color: #fff; }

.pt-login-foot {
    margin: 16px 0 0;
    text-align: center;
    font-size: 11.5px;
    color: #8b929c;
}

@media (max-width: 820px) {
    .pt-sidebar { display: none; }
    .pt-topbar { left: 0; }
    .pt-main { margin-left: 0; }
}

/* ---------- lists, filters, tables (Phase 4) ---------- */

.pt-page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pt-back { font-size: 12px; text-decoration: none; color: #6c7480; display: inline-block; margin-bottom: 4px; }
.pt-back:hover { color: var(--pt-red); }
.pt-hint { font-size: 11px; color: #8b929c; font-weight: 400; }
.pt-mt { margin-top: 10px; }

.pt-filters {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    background: var(--pt-card); border: 1px solid var(--pt-card-line);
    border-radius: 8px; padding: 10px 12px; margin-bottom: 14px;
    position: sticky; top: calc(var(--pt-topbar-h) + 0px); z-index: 5;
}
.pt-filters .form-control, .pt-filters .form-select { width: auto; min-width: 130px; }
.pt-filter-wide { min-width: 240px !important; flex: 1; }
.pt-check { display: flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }

.pt-btn-outline, .pt-btn-ghost {
    background: transparent; border: 1px solid var(--pt-card-line); color: #444a53;
}
.pt-btn-ghost { border-color: transparent; }
.pt-btn-outline:hover, .pt-btn-ghost:hover { background: #eef0f3; color: #1d2129; }

.pt-table-wrap {
    background: var(--pt-card); border: 1px solid var(--pt-card-line);
    border-radius: 8px; overflow: auto; max-height: calc(100vh - 260px);
}
.pt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pt-table thead th {
    position: sticky; top: 0; background: #f2f4f7; z-index: 1;
    text-align: left; font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: .05em; color: #5b626c;
    padding: 8px 10px; border-bottom: 1px solid var(--pt-card-line); white-space: nowrap;
}
.pt-table thead th a { color: inherit; text-decoration: none; }
.pt-table thead th a:hover { color: var(--pt-red); }
.pt-table tbody td { padding: 7px 10px; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
.pt-table tbody tr:last-child td { border-bottom: none; }
.pt-row-link { cursor: pointer; }
.pt-row-link:hover { background: #fafbfc; }
.pt-table-tight { font-size: 12.5px; }
.pt-table-tight thead th { background: transparent; }
.pt-num { text-align: right; }
.pt-nowrap { white-space: nowrap; }
.pt-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.pt-break { word-break: break-all; }
.pt-sub { display: block; color: #8b929c; font-size: 11.5px; }
.pt-bad { color: var(--pt-red); font-weight: 600; }
.pt-more { display: inline-block; margin-top: 8px; font-size: 12.5px; }

.pt-chip {
    display: inline-block; padding: 1px 7px; border-radius: 10px;
    font-size: 11px; font-weight: 500; background: #eef0f3; color: #4a5058; white-space: nowrap;
}
.pt-chip-completed { background: #e5f5e9; color: #1a7f37; }
.pt-chip-cancelled { background: #fde8ea; color: #a4232f; }
.pt-chip-pending { background: #fff4e0; color: #8a5a00; }
.pt-chip-preparing { background: #e6f0fd; color: #1f5fb0; }
.pt-chip-foodreadytodispatch { background: #e9e6fd; color: #4a35b5; }
.pt-chip-out_for_delivery { background: #e0f4f6; color: #146b78; }
.pt-chip-pay-paid { background: #e5f5e9; color: #1a7f37; }
.pt-chip-pay-refunded { background: #fff4e0; color: #8a5a00; }
.pt-chip-pay-unpaid, .pt-chip-pay-failed { background: #fde8ea; color: #a4232f; }
.pt-chip-pay-unknown { background: #eef0f3; color: #6c7480; }

.pt-tag {
    display: inline-block; padding: 0 5px; border-radius: 3px; margin-left: 5px;
    font-size: 9.5px; font-weight: 700; letter-spacing: .05em;
    background: #eef0f3; color: #6c7480; vertical-align: middle;
}
.pt-tag-test { background: #fff4e0; color: #8a5a00; }
.pt-tag-refund { background: #fde8ea; color: #a4232f; }

.pt-empty {
    background: var(--pt-card); border: 1px dashed var(--pt-card-line);
    border-radius: 8px; padding: 36px 20px; text-align: center;
}

.pt-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12.5px; }
.pt-pager-info { color: #6c7480; }
.pt-pager-links { display: flex; gap: 4px; }
.pt-pager-links a, .pt-pager-current {
    display: inline-block; min-width: 28px; text-align: center; padding: 3px 7px;
    border: 1px solid var(--pt-card-line); border-radius: 5px; text-decoration: none; color: #444a53;
}
.pt-pager-links a:hover { background: #eef0f3; }
.pt-pager-current { background: var(--pt-red); border-color: var(--pt-red); color: #fff; font-weight: 600; }

/* ---------- detail pages ---------- */

.pt-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.pt-detail-main, .pt-detail-side { display: flex; flex-direction: column; gap: 14px; }
.pt-panel-quiet { background: #f7f8fa; }
.pt-alert { padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.pt-head-actions { display: flex; gap: 8px; }

.pt-dl { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 7px 12px; margin: 10px 0 0; }
.pt-dl-tight { grid-template-columns: 92px minmax(0, 1fr); gap: 5px 10px; font-size: 12.5px; }
.pt-dl dt { color: #6c7480; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding-top: 1px; }
.pt-dl dd { margin: 0; }
.pt-dl .pt-total { font-weight: 700; border-top: 1px solid var(--pt-card-line); padding-top: 6px; margin-top: 3px; }

.pt-inline-form { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.pt-revealed { color: #1a7f37 !important; border-color: #1a7f37 !important; }
.pt-note { white-space: pre-wrap; }

.pt-timeline { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid #e3e6ea; }
.pt-timeline li { position: relative; padding: 0 0 14px 16px; font-size: 13px; }
.pt-timeline li:last-child { padding-bottom: 0; }
.pt-timeline-dot {
    position: absolute; left: -21px; top: 4px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--pt-red); border: 2px solid #fff;
}
.pt-timeline-time { color: #8b929c; margin-right: 9px; }
.pt-timeline-label { font-weight: 500; }
.pt-timeline-detail { display: block; color: #6c7480; font-size: 12px; margin-top: 1px; }

.pt-annotate { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.pt-annotate textarea { flex: 1; }
.pt-notes { list-style: none; margin: 12px 0 0; padding: 0; }
.pt-notes li { padding: 9px 0; border-top: 1px solid #f0f2f4; }
.pt-note-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.pt-note-head .pt-sub { display: inline; }
.pt-note-body { white-space: pre-wrap; font-size: 13px; margin-top: 3px; }

.pt-refund-box {
    margin-top: 10px; padding: 8px 10px; border-radius: 6px;
    background: #fff4e0; color: #8a5a00; font-size: 12.5px;
}
.pt-links { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.pt-links li { padding: 3px 0; }

.pt-bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; margin-top: 12px; }
.pt-bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.pt-bar { width: 100%; background: var(--pt-red); border-radius: 2px 2px 0 0; opacity: .82; min-height: 2px; }
.pt-bar-col:hover .pt-bar { opacity: 1; }
.pt-bar-label { font-size: 9px; color: #9aa1ab; margin-top: 3px; }

@media (max-width: 1100px) {
    .pt-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- logs (Phase 5) ---------- */

.pt-mb { margin-bottom: 14px; }
.pt-subhead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6c7480; margin: 14px 0 6px; }
.pt-sub-inline { color: #8b929c; font-size: 11.5px; margin-right: 6px; }

.pt-lvl-verbose, .pt-lvl-debug { background: #eef0f3; color: #6c7480; }
.pt-lvl-information { background: #e6f0fd; color: #1f5fb0; }
.pt-lvl-warning { background: #fff4e0; color: #8a5a00; }
.pt-lvl-error, .pt-lvl-fatal { background: #fde8ea; color: #a4232f; }

.pt-log-row { cursor: pointer; }
.pt-log-row:hover { background: #fafbfc; }
.pt-log-msg { max-width: 620px; }
.pt-log-detail > td { background: #fafbfc; }

.pt-pre {
    margin: 8px 0 0; padding: 9px 11px; border-radius: 6px;
    background: #14161a; color: #d8dbe0; font-size: 11.5px;
    white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
}
.pt-pre-error { background: #2a1416; color: #f0c8cc; }

.pt-bars-short { height: 84px; }
.pt-bar { position: relative; }
.pt-bar-error { position: absolute; left: 0; right: 0; bottom: 0; background: #a4232f; border-radius: 0 0 2px 2px; }

.pt-source-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pt-source-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: 12px; border: 1px solid var(--pt-card-line);
    font-size: 11.5px; text-decoration: none; color: #444a53; background: #fff;
}
.pt-source-chip:hover { background: #eef0f3; color: #1d2129; }
.pt-source-chip-bad { border-color: #f0bfc4; }
.pt-source-count { color: #8b929c; }
.pt-source-err {
    background: #fde8ea; color: #a4232f; border-radius: 8px;
    padding: 0 5px; font-weight: 600;
}

.pt-timeline-dot.pt-dot-error { background: #a4232f; }

/* ── Phase 6: tickets ─────────────────────────────────────────────────────── */

.pt-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pt-stat {
    background: var(--pt-card); border: 1px solid var(--pt-card-line); border-radius: 8px;
    padding: 8px 14px; min-width: 92px;
}
.pt-stat-num { display: block; font-size: 20px; font-weight: 600; line-height: 1.15; }
.pt-stat-label {
    display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #5b626c;
}
.pt-stat.pt-bad .pt-stat-num { color: var(--pt-red); }

/* An overdue row is tinted rather than reddened throughout: the due cell already says why. */
.pt-row-bad td { background: #fff7f8; }

.pt-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.pt-board-col {
    background: var(--pt-card); border: 1px solid var(--pt-card-line); border-radius: 8px;
    padding: 10px; min-width: 240px; flex: 1 0 240px;
}
.pt-board-col h2 {
    font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #5b626c;
    margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center;
}
.pt-board-card {
    border: 1px solid var(--pt-card-line); border-radius: 6px; padding: 7px 9px; margin-bottom: 7px;
    font-size: 12.5px;
}
.pt-board-card a { text-decoration: none; color: inherit; }
.pt-board-card a:hover strong { color: var(--pt-red); }

.pt-form { max-width: 720px; }
.pt-form-actions { display: flex; gap: 8px; margin-top: 14px; }

/* The sidebar forms on ticket detail stack their controls; the filter bar they borrow is a row. */
.pt-detail-grid aside .pt-filters { display: block; }
.pt-detail-grid aside .form-select,
.pt-detail-grid aside .form-control { margin-bottom: 6px; }
.pt-detail-grid aside form { margin-top: 8px; }

/* Phase 7: the per-row action forms on the agents table sit side by side, not stacked. */
.pt-inline-form { display: inline-flex; gap: 4px; margin-right: 6px; }
.pt-inline-form .form-control { width: 150px; }
.pt-table form { display: inline-block; margin: 0; }
