:root {
  --ink: #0c1d33;
  --ink-soft: #55667d;
  --line: #e4eaf1;
  --surface: #ffffff;
  --canvas: #f5f8fb;
  --brand: #0ca96a;
  --brand-dark: #07744c;
  --accent: #ff8300;
  --danger: #dc315c;
  --warning: #f0a017;
  --shadow: 0 18px 42px rgba(12, 29, 51, .10);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 8%, rgba(12,169,106,.25), transparent 28%), radial-gradient(circle at 0% 90%, rgba(255,131,0,.18), transparent 32%), #081b30; }
.auth-card { width: min(100%, 460px); padding: 38px; border-radius: 26px; color: var(--ink); background: rgba(255,255,255,.98); box-shadow: 0 32px 90px rgba(0,0,0,.28); }
.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.brand-lockup small { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auth-card h1 { margin: 38px 0 7px; font-size: 28px; line-height: 1.1; letter-spacing: -.05em; }
.auth-card p { margin: 0 0 28px; color: var(--ink-soft); }
.field { display: grid; gap: 8px; margin: 15px 0; }
.field label, .filter-label { color: var(--ink); font-size: 12px; font-weight: 750; }
.field input, .field select, .toolbar input, .toolbar select, .ticket-composer textarea { width: 100%; border: 1px solid #ced9e6; border-radius: 12px; padding: 12px 13px; outline: none; color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field select:focus, .toolbar input:focus, .toolbar select:focus, .ticket-composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,169,106,.13); }
.form-error { min-height: 20px; margin-top: 12px; color: #b22646; font-size: 13px; }
.auth-footnote { margin-top: 24px; color: #718096; font-size: 12px; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 10; height: 100vh; padding: 22px 15px; display: flex; flex-direction: column; color: #dce8f6; background: #0a1d33; }
.sidebar .brand-lockup { padding: 2px 10px 27px; color: white; }
.sidebar .brand-lockup small { color: #8faccc; }
.nav-caption { padding: 17px 11px 8px; color: #81a0c1; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 12px; color: #dce8f6; background: transparent; text-align: left; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.is-active { color: #fff; background: linear-gradient(135deg, var(--brand), #087d59); box-shadow: 0 9px 22px rgba(6,117,77,.3); }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; font-size: 16px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.11); padding: 19px 10px 2px; }
.identity { display: flex; align-items: center; gap: 10px; }
.identity-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg,#ff9518,#df5c0b); font-weight: 800; }
.identity strong, .identity small { display:block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity small { color: #8faccc; font-size: 11px; }

.workspace { min-width: 0; }
.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); }
.mobile-brand { display: none; }
.page-context { color: var(--ink-soft); font-size: 13px; }
.page-context strong { color: var(--ink); }
.topbar-actions { display:flex; align-items:center; gap: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 100%; background: #27be78; box-shadow: 0 0 0 4px rgba(39,190,120,.12); }
.status-text { color: #567087; font-size: 12px; font-weight: 650; }
.content { max-width: 1500px; margin: 0 auto; padding: 34px; }
.view-head { display:flex; align-items: flex-start; justify-content:space-between; gap:20px; margin-bottom: 26px; }
.eyebrow { color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.view-head h1 { margin: 5px 0 7px; font-size: clamp(27px, 3vw, 38px); line-height: 1; letter-spacing: -.055em; }
.view-head p { margin: 0; color: var(--ink-soft); }
.button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: 0 15px; color:#fff; background: var(--brand); font-weight: 760; text-decoration: none; transition: .18s ease; }
.button:hover { filter: brightness(.94); transform: translateY(-1px); color:#fff; text-decoration: none; }
.button-secondary { border-color:#c9d5e2; color:var(--ink); background:#fff; }
.button-secondary:hover { color:var(--ink); background:#f8fafc; }
.button-danger { background: var(--danger); }
.icon-button { width: 42px; padding: 0; }
.button:disabled { cursor:not-allowed; opacity:.55; transform:none; }

.stats-grid { display:grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap:16px; }
.stat-card { min-height: 145px; position:relative; overflow:hidden; border:1px solid var(--line); border-radius: 18px; padding: 21px; background:var(--surface); box-shadow: 0 4px 14px rgba(14,43,77,.025); }
.stat-card::after { content:""; position:absolute; width:100px; height:100px; border-radius:50%; right:-42px; bottom:-52px; background:rgba(12,169,106,.08); }
.stat-card.orange::after { background:rgba(255,131,0,.12); }
.stat-card.red::after { background:rgba(220,49,92,.09); }
.stat-label { color:var(--ink-soft); font-size: 13px; font-weight: 680; }
.stat-value { margin-top:17px; color:var(--ink); font-size: 27px; font-weight:850; letter-spacing:-.05em; }
.stat-foot { margin-top: 8px; color:#6d8095; font-size: 12px; }
.stat-icon { position:absolute; top:20px; right:20px; width:35px; height:35px; display:grid; place-items:center; border-radius:11px; color:var(--brand-dark); background:rgba(12,169,106,.1); font-size:16px; }
.orange .stat-icon { color:#ad6200; background:#fff0dd; }.red .stat-icon { color:#bd2047; background:#ffe6ed; }

.panel-grid { display:grid; grid-template-columns: 1.45fr .95fr; gap:18px; margin-top:18px; }
.panel, .table-panel { overflow:hidden; border:1px solid var(--line); border-radius:18px; background:var(--surface); }
.panel-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:20px 22px; border-bottom:1px solid var(--line); }
.panel-heading h2 { margin:0; font-size:16px; letter-spacing:-.025em; }.panel-heading p { margin:3px 0 0; color:var(--ink-soft); font-size:12px; }
.inline-link { border:0; padding:0; color:var(--brand-dark); background:none; font-size:12px; font-weight:800; }
.store-list { margin: 0; padding: 0; list-style:none; }.store-list li { display:flex; align-items:center; gap:12px; padding:14px 22px; border-bottom:1px solid #edf1f5; }.store-list li:last-child { border:0; }
.store-initial { width:36px;height:36px;display:grid;place-items:center;border-radius:11px;background:#e9f8f0;color:var(--brand-dark);font-weight:850; }.list-main { min-width:0; flex:1; }.list-main strong,.list-main small { display:block; overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }.list-main small { color:var(--ink-soft); font-size:12px; }.activity-list { list-style:none; margin:0; padding:4px 22px; }.activity-list li { position:relative; padding:15px 0 15px 20px; border-bottom:1px solid #edf1f5; }.activity-list li:last-child { border:0; }.activity-list li::before { content:""; width:7px; height:7px; position:absolute; top:22px; left:0; border-radius:50%; background:var(--brand); }.activity-list strong,.activity-list small { display:block; }.activity-list small { color:var(--ink-soft); font-size:12px; }
.health-list { padding: 6px 22px 16px; }.health-row { display:flex; align-items:center; justify-content:space-between; padding:14px 0; border-bottom:1px solid #edf1f5; }.health-row:last-child{border:0}.health-label{color:var(--ink-soft);font-size:13px}.health-value{font-weight:820}.health-good{color:#0b8d59}.health-warn{color:#bd7400}.health-bad{color:#c3294d}

.toolbar { display:grid; grid-template-columns: minmax(220px, 1.25fr) repeat(2,minmax(150px,.6fr)) auto; align-items:end; gap:12px; margin-bottom:17px; }.toolbar .filter { display:grid; gap:7px; }.toolbar .button { min-height:43px; }.table-wrap { overflow:auto; }.data-table { width:100%; border-collapse:collapse; text-align:left; white-space:nowrap; }.data-table th { padding:13px 18px; color:#667a91; border-bottom:1px solid var(--line); background:#fbfcfd; font-size:10px; font-weight:850; letter-spacing:.09em; text-transform:uppercase; }.data-table td { padding:15px 18px; border-bottom:1px solid #edf1f5; vertical-align:middle; }.data-table tr:last-child td{border:0}.data-table td strong,.data-table td small{display:block}.data-table td small{color:var(--ink-soft);font-size:12px}.table-empty { padding:42px 18px; color:var(--ink-soft); text-align:center; }.compact-button { min-height:33px; padding:0 11px; border-radius:9px; font-size:12px; }
.badge { display:inline-flex; align-items:center; justify-content:center; min-height:25px; border-radius:50px; padding:3px 9px; font-size:11px; font-weight:800; }.badge-active,.badge-paid,.badge-resolved { color:#08754b;background:#def7ea; }.badge-pending_review,.badge-waiting_customer,.badge-past_due { color:#a46400;background:#fff2d9; }.badge-suspended,.badge-closed,.badge-urgent { color:#b82045;background:#ffe3eb; }.badge-draft,.badge-open,.badge-trialing { color:#506b87;background:#eaf0f7; }.badge-in_progress,.badge-normal { color:#126f8a;background:#dff5fb; }.badge-high{color:#854a09;background:#ffe9cc; }.badge-low{color:#586a80;background:#eef2f6;}
.pagination-note { padding:13px 18px; border-top:1px solid var(--line); color:var(--ink-soft); font-size:12px; }

.ticket-drawer { width:min(100%, 560px); height:100vh; position:fixed; z-index:100; top:0; right:0; transform:translateX(101%); display:flex; flex-direction:column; border-left:1px solid var(--line); background:#fff; box-shadow:-18px 0 55px rgba(12,29,51,.17); transition:transform .25s ease; }.ticket-drawer.is-open { transform:translateX(0); }.drawer-backdrop { position:fixed; z-index:90; inset:0; background:rgba(5,19,34,.43); opacity:0; visibility:hidden; transition:.2s ease; }.drawer-backdrop.is-open{opacity:1;visibility:visible}.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:24px;border-bottom:1px solid var(--line)}.drawer-head h2{margin:4px 0;font-size:20px;letter-spacing:-.04em}.close-button{border:1px solid var(--line);width:36px;height:36px;border-radius:10px;color:var(--ink);background:#fff;font-size:20px}.ticket-meta{display:flex;gap:8px;flex-wrap:wrap;padding:15px 24px;border-bottom:1px solid var(--line)}.ticket-thread{min-height:0;flex:1;overflow:auto;padding:20px 24px;background:#f8fafc}.message{max-width:90%;margin:0 0 14px;padding:13px 14px;border-radius:14px 14px 14px 3px;background:#fff;border:1px solid var(--line)}.message.internal{margin-left:auto;border-color:#ffdcaf;background:#fff8eb;border-radius:14px 14px 3px 14px}.message strong,.message small{display:block}.message small{margin-top:3px;color:var(--ink-soft);font-size:11px}.message p{margin:8px 0 0;white-space:pre-wrap}.ticket-composer{padding:18px 24px;border-top:1px solid var(--line);background:#fff}.ticket-composer textarea{min-height:86px;resize:vertical}.composer-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:9px}.checkbox{display:flex;align-items:center;gap:7px;color:var(--ink-soft);font-size:12px}.drawer-actions{display:flex;gap:8px;padding:0 24px 16px}.drawer-actions select{flex:1;border:1px solid #ced9e6;border-radius:10px;padding:10px;background:#fff}

.toast-zone{position:fixed;z-index:200;right:20px;bottom:20px;display:grid;gap:10px}.toast{width:min(350px,calc(100vw - 40px));padding:14px 16px;border-radius:13px;color:#fff;background:#0c1d33;box-shadow:var(--shadow);font-weight:650}.toast.success{background:#087b51}.toast.error{background:#bd294c}.loading-row{padding:30px;color:var(--ink-soft);text-align:center}.skeleton{height:15px;border-radius:7px;background:linear-gradient(100deg,#eff3f6 20%,#f8fafb 40%,#eff3f6 60%);background-size:200% 100%;animation: shimmer 1.2s infinite}@keyframes shimmer{to{background-position:-200% 0}}

@media (max-width:1100px){.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.panel-grid{grid-template-columns:1fr}.toolbar{grid-template-columns:1fr 1fr}.toolbar .filter:first-child{grid-column:span 2}.app-shell{grid-template-columns:225px minmax(0,1fr)}.content{padding:26px}.topbar{padding:0 26px}}
@media (max-width:760px){.app-shell{display:block}.sidebar{position:fixed;left:0;top:0;width:245px;transform:translateX(-103%);transition:transform .22s;box-shadow:8px 0 30px rgba(0,0,0,.25)}.sidebar.is-open{transform:translateX(0)}.topbar{height:68px;padding:0 18px}.mobile-brand{display:flex;align-items:center;gap:9px;font-weight:820}.mobile-brand .brand-mark{width:30px;height:30px}.page-context{display:none}.content{padding:24px 16px}.view-head{display:block}.view-head .button{margin-top:16px}.stats-grid{grid-template-columns:1fr}.toolbar{grid-template-columns:1fr}.toolbar .filter:first-child{grid-column:auto}.topbar-actions .status-text{display:none}.ticket-drawer{width:100%}.table-wrap{border-radius:0}.data-table th,.data-table td{padding-left:13px;padding-right:13px}}
