:root {
  --navy: #132334;
  --navy-2: #1c3147;
  --ink: #172333;
  --muted: #6f7f90;
  --line: #e4e9ee;
  --surface: #ffffff;
  --page: #f5f7f9;
  --blue: #2176d2;
  --blue-soft: #eaf3fd;
  --green: #187b5b;
  --green-soft: #e6f5ef;
  --amber: #a56310;
  --amber-soft: #fff2dc;
  --shadow: 0 8px 28px rgba(25, 47, 70, 0.07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; font-family: "Heebo", Arial, sans-serif; color: var(--ink); background: var(--page); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 244px; }
.sidebar { grid-column: 2; grid-row: 1; position: sticky; top: 0; height: 100vh; padding: 30px 22px 24px; color: #fff; background: linear-gradient(175deg, var(--navy), #0d1a27); display: flex; flex-direction: column; z-index: 5; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.11); color: #71b5fb; margin-bottom: 13px; }
.brand-mark svg { width: 25px; height: 25px; }
.brand-title { display: block; font-size: 24px; font-weight: 800; line-height: 1.15; }
.brand-subtitle { color: #9eb0c2; font-size: 14px; }
.nav-list { margin-top: 44px; display: grid; gap: 8px; }
.nav-item { width: 100%; border: 0; border-radius: 11px; padding: 12px 13px; background: transparent; color: #b5c3d1; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; text-align: right; font-weight: 600; transition: .2s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: #2176d2; box-shadow: 0 7px 20px rgba(0,0,0,.18); }
.nav-icon { display: grid; place-items: center; }
.nav-badge { min-width: 23px; padding: 2px 6px; border-radius: 12px; text-align: center; font-size: 12px; background: rgba(255,255,255,.2); }
.nav-badge.muted { background: rgba(255,255,255,.08); }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.09); display: flex; align-items: center; gap: 8px; color: #8497aa; font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #48c99b; box-shadow: 0 0 0 4px rgba(72,201,155,.1); }

.main-content { grid-column: 1; min-width: 0; }
.topbar { height: 91px; padding: 0 42px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 2px 0 0; font-size: 21px; font-weight: 700; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.settings-button, .display-link { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 9px; border: 1px solid var(--line); text-decoration: none; }
.settings-button { color: #758391; background: #f7f9fa; }
.settings-button:hover { background: #f0f3f5; }
.settings-button svg { width: 18px; }
.display-link { color: var(--blue); background: var(--blue-soft); border-color: #cfe3f8; font-weight: 700; }
.display-link:hover { background: #deecfa; }
.view { padding: 35px 42px 48px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 27px; }
.page-intro h2 { margin: 0; font-size: 28px; line-height: 1.25; }
.page-intro p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.title-row { display: flex; align-items: center; gap: 12px; }
.count-pill { padding: 4px 10px; border-radius: 20px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 700; }
.count-pill.neutral { color: #657382; background: #e9edf1; }
.primary-button, .secondary-button { border-radius: 9px; padding: 10px 16px; border: 1px solid transparent; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primary-button { color: white; background: var(--blue); box-shadow: 0 5px 14px rgba(33,118,210,.18); }
.primary-button:hover { background: #1769c1; }
.primary-button svg { width: 18px; }
.secondary-button { color: #5f6f7f; background: #fff; border-color: var(--line); }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.summary-card { min-height: 124px; padding: 20px 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 3px 14px rgba(25,47,70,.035); position: relative; overflow: hidden; }
.summary-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--card-accent); }
.summary-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.summary-card strong { display: block; margin-top: 6px; font-size: 31px; line-height: 1; color: var(--ink); }
.summary-card small { display: block; margin-top: 10px; color: #91a0ad; }
.accent-blue { --card-accent: var(--blue); }
.accent-amber { --card-accent: #d9922c; }
.accent-green { --card-accent: #39a980; }

.table-card { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar { min-height: 67px; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.search-box { width: min(390px, 100%); height: 41px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; display: flex; align-items: center; gap: 9px; color: #9aa8b5; background: #fbfcfd; }
.search-box:focus-within { border-color: #80b6ed; box-shadow: 0 0 0 3px #eaf3fd; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box svg { width: 18px; flex: 0 0 auto; }
.table-toolbar select { height: 41px; min-width: 130px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; color: #526272; background: #fff; outline: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 960px; border-collapse: collapse; }
th { padding: 13px 16px; color: #788797; background: #f8fafb; font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap; }
td { padding: 18px 16px; border-top: 1px solid #edf0f3; vertical-align: middle; font-size: 13px; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfdff; }
.row-number { color: #97a4b1; font-weight: 600; }
.ticket-number { color: var(--blue); font-weight: 800; white-space: nowrap; }
.ticket-title { display: block; font-weight: 700; font-size: 14px; color: #263646; }
.ticket-description { display: block; margin-top: 3px; max-width: 320px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta-line { display: block; color: #536476; white-space: nowrap; }
.meta-line + .meta-line { margin-top: 2px; color: #8795a2; }
.date-cell { white-space: nowrap; color: #526272; }
.channel-tag { display: inline-flex; margin-top: 7px; padding: 2px 8px; border-radius: 12px; background: #f0f3f6; color: #647485; font-size: 11px; font-weight: 700; }
.category-select, .category-label { display: inline-flex; margin: 7px 6px 0 0; padding: 2px 8px; border: 1px solid #d7e1ea; border-radius: 12px; background: #edf6ff; color: #26628f; font: inherit; font-size: 11px; font-weight: 700; }
.category-select { cursor: pointer; }
.status-dot.offline { background: #ef6b65; box-shadow: 0 0 0 4px rgba(239,107,101,.12); }
.complete-button { border: 1px solid #bfe4d6; border-radius: 8px; padding: 7px 13px; color: var(--green); background: var(--green-soft); font-weight: 700; white-space: nowrap; }
.complete-button:hover { background: #d7efe6; }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--ink); font-size: 17px; }
.empty-state span { margin-top: 4px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; padding: 25px; background: rgba(8,18,28,.58); display: grid; place-items: center; backdrop-filter: blur(3px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(680px, 100%); max-height: calc(100vh - 50px); overflow-y: auto; border-radius: 15px; background: #fff; box-shadow: 0 25px 80px rgba(0,0,0,.25); }
.modal-header { padding: 23px 25px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header h2 { margin: 3px 0 0; font-size: 22px; }
.modal-kicker { color: var(--blue); font-size: 12px; font-weight: 700; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; color: #758392; background: #f2f5f7; font-size: 25px; line-height: 1; }
#ticket-form { padding: 22px 25px 25px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid label span { display: block; margin-bottom: 6px; color: #526272; font-size: 13px; font-weight: 700; }
.form-grid input, .form-grid textarea { width: 100%; border: 1px solid #dce3e8; border-radius: 8px; padding: 10px 11px; outline: 0; color: var(--ink); background: #fff; resize: vertical; }
.form-grid input:focus, .form-grid textarea:focus { border-color: #6aa8e5; box-shadow: 0 0 0 3px #eaf3fd; }
.full-width { grid-column: 1 / -1; }
.modal-actions { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-start; gap: 10px; }
.toast { position: fixed; z-index: 30; left: 24px; bottom: 24px; min-width: 250px; max-width: calc(100vw - 48px); padding: 12px 16px; border-radius: 9px; color: #fff; background: #182838; box-shadow: 0 10px 35px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { grid-column: 1; grid-row: 1; position: sticky; height: auto; padding: 13px 18px; flex-direction: row; align-items: center; gap: 12px; }
  .brand-mark { width: 38px; height: 38px; margin: 0; }
  .brand-copy { display: none; }
  .nav-list { margin: 0; display: flex; gap: 5px; }
  .nav-item { width: auto; grid-template-columns: 21px auto auto; padding: 9px 11px; }
  .sidebar-footer { display: none; }
  .main-content { grid-column: 1; grid-row: 2; }
  .topbar { height: 73px; padding: 0 22px; }
  .topbar h1 { font-size: 18px; }
  .view { padding: 26px 22px 38px; }
  .summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 590px) {
  .nav-item span:nth-child(2) { display: none; }
  .page-intro { align-items: stretch; flex-direction: column; }
  .page-intro .primary-button { width: 100%; }
  .title-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .settings-button span, .display-link span { display: none; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-toolbar select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
}
