/* ============================================================
   UnitekIT Solutions CRM — style.css
   Dark/Light mode, teal-indigo SaaS dashboard aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --font-sans:  'DM Sans', ui-sans-serif, system-ui, sans-serif;
    --font-mono:  'JetBrains Mono', ui-monospace, monospace;

    /* Accent palette */
    --teal-400:   #2dd4bf;
    --teal-500:   #14b8a6;
    --teal-600:   #0d9488;
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;

    --accent:          var(--teal-500);
    --accent-hover:    var(--teal-400);
    --accent-gradient: linear-gradient(135deg, var(--teal-500) 0%, var(--indigo-500) 100%);
    --accent-glow:     0 0 20px rgba(20,184,166,.25);

    /* Status colors */
    --green:  #22c55e;
    --yellow: #f59e0b;
    --orange: #f97316;
    --red:    #ef4444;
    --blue:   #3b82f6;
    --purple: #a855f7;
    --gray:   #6b7280;

    /* Radius */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --trans: all .18s ease;

    /* Sidebar */
    --sidebar-w: 240px;
    --topbar-h:  60px;
}

/* ── Dark Theme (default) ──────────────────────────────────── */
[data-theme="dark"] {
    --bg-base:      #0c0f14;
    --bg-surface:   #141820;
    --bg-elevated:  #1c2230;
    --bg-hover:     #202840;
    --bg-active:    rgba(20,184,166,.1);

    --border:       rgba(255,255,255,.08);
    --border-focus: var(--teal-500);

    --text-primary:  #f0f4f8;
    --text-secondary:#a8b5c8;
    --text-muted:    #637289;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,.45);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.6);

    --input-bg:   #1c2230;
    --input-border: rgba(255,255,255,.1);
    --scrollbar-thumb: #2a3348;
}

/* ── Light Theme ───────────────────────────────────────────── */
[data-theme="light"] {
    --bg-base:      #f0f2f5;
    --bg-surface:   #ffffff;
    --bg-elevated:  #f8f9fc;
    --bg-hover:     #f1f4f8;
    --bg-active:    rgba(20,184,166,.08);

    --border:       rgba(0,0,0,.09);
    --border-focus: var(--teal-600);

    --text-primary:  #111827;
    --text-secondary:#374151;
    --text-muted:    #6b7280;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,.1);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.14);

    --input-bg:   #ffffff;
    --input-border: rgba(0,0,0,.14);
    --scrollbar-thumb: #c8cfd9;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: var(--trans); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

img { max-width: 100%; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 99px; }

/* ── Layout ────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 36px; height: 36px;
    background: var(--accent-gradient);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: var(--accent-glow);
}

.sidebar-brand-text {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.sidebar-brand-text small {
    display: block;
    font-size: .7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: .75rem 0;
}

.sidebar-section {
    padding: .35rem 1.25rem .15rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: .5rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.25rem;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 450;
    border-radius: 0;
    transition: var(--trans);
    cursor: pointer;
    position: relative;
}

.sidebar-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.sidebar-item.active {
    color: var(--accent);
    background: var(--bg-active);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .4rem;
    border-radius: 99px;
    line-height: 1.4;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: .75rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--trans);
    text-decoration: none;
    color: var(--text-secondary);
}
.sidebar-user:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: .825rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .7rem; color: var(--text-muted); text-transform: capitalize; }

/* ── Main Content ──────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: .25rem;
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .75rem;
    gap: .5rem;
    width: 240px;
    transition: var(--trans);
}
.topbar-search:focus-within { border-color: var(--accent); width: 300px; }
.topbar-search input { background: none; border: none; outline: none; font-size: .85rem; color: var(--text-primary); width: 100%; font-family: var(--font-sans); }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search-icon { color: var(--text-muted); font-size: .9rem; flex-shrink: 0; }

.topbar-actions { display: flex; align-items: center; gap: .5rem; }

.topbar-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: var(--trans);
    position: relative;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.topbar-btn .notif-dot {
    position: absolute; top: 6px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--red);
    border: 1.5px solid var(--bg-surface);
}

/* ── Page Content ──────────────────────────────────────────── */
.content {
    padding: 1.75rem 1.75rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-left { flex: 1; }

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    margin-top: .2rem;
}

.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    transition: var(--trans);
    position: relative;
    overflow: hidden;
}

.stat-card:hover { border-color: rgba(20,184,166,.25); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--trans);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: .25rem;
}

.stat-icon.teal   { background: rgba(20,184,166,.15); }
.stat-icon.indigo { background: rgba(99,102,241,.15); }
.stat-icon.orange { background: rgba(249,115,22,.15); }
.stat-icon.red    { background: rgba(239,68,68,.15); }
.stat-icon.green  { background: rgba(34,197,94,.15); }
.stat-icon.yellow { background: rgba(245,158,11,.15); }
.stat-icon.purple { background: rgba(168,85,247,.15); }
.stat-icon.blue   { background: rgba(59,130,246,.15); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-change {
    font-size: .75rem;
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-top: .25rem;
}
.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change.neutral { color: var(--text-muted); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions { display: flex; gap: .5rem; }

.card-body { padding: 1.25rem; }

.card-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

/* ── Grid Layouts ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; }
.grid-aside-main { display: grid; grid-template-columns: 340px 1fr; gap: 1.25rem; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    background: var(--bg-elevated);
    padding: .7rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
tbody tr { transition: background .12s; }

.table-cell-primary { color: var(--text-primary); font-weight: 500; }
.table-cell-mono { font-family: var(--font-mono); font-size: .8rem; }
.table-cell-muted { color: var(--text-muted); font-size: .8rem; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    white-space: nowrap;
}

.badge-low      { background: rgba(107,114,128,.2); color: #9ca3af; }
.badge-medium   { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-high     { background: rgba(249,115,22,.15); color: #fb923c; }
.badge-critical { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }

.badge-open     { background: rgba(59,130,246,.15);  color: #60a5fa; }
.badge-progress { background: rgba(168,85,247,.15);  color: #c084fc; }
.badge-waiting  { background: rgba(245,158,11,.15);  color: #f59e0b; }
.badge-resolved { background: rgba(34,197,94,.15);   color: #4ade80; }
.badge-closed   { background: rgba(107,114,128,.2);  color: #9ca3af; }

.badge-draft    { background: rgba(107,114,128,.2);  color: #9ca3af; }
.badge-sent     { background: rgba(59,130,246,.15);  color: #60a5fa; }
.badge-paid     { background: rgba(34,197,94,.15);   color: #4ade80; }
.badge-overdue  { background: rgba(239,68,68,.15);   color: #f87171; }
.badge-partial  { background: rgba(245,158,11,.15);  color: #f59e0b; }
.badge-cancelled{ background: rgba(107,114,128,.2);  color: #9ca3af; }
.badge-active   { background: rgba(20,184,166,.15);  color: #2dd4bf; }
.badge-void     { background: rgba(107,114,128,.2);  color: #9ca3af; text-decoration: line-through; }

.badge-sla-breach { background: rgba(239,68,68,.2); color: #f87171; animation: pulse-badge 2s infinite; }
@keyframes pulse-badge { 0%,100% { opacity:1; } 50% { opacity:.6; } }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .875rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--trans);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--teal-400); color: #fff; box-shadow: 0 4px 12px rgba(20,184,166,.35); }

.btn-indigo {
    background: var(--indigo-500);
    color: #fff;
    border-color: var(--indigo-500);
}
.btn-indigo:hover { background: var(--indigo-400); color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); border-color: rgba(255,255,255,.15); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
    background: rgba(239,68,68,.15);
    color: var(--red);
    border-color: rgba(239,68,68,.25);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
    background: rgba(34,197,94,.15);
    color: var(--green);
    border-color: rgba(34,197,94,.25);
}
.btn-success:hover { background: var(--green); color: #fff; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .45rem; aspect-ratio: 1; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .4rem;
}

.form-label .req { color: var(--red); margin-left: .2rem; }

.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    font-size: .875rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    transition: var(--trans);
    outline: none;
    appearance: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,184,166,.12); }

textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.6; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; cursor: pointer; }

.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .75rem; color: var(--red); margin-top: .3rem; }

.input-icon-right { position: relative; }
.input-icon-right .form-control { padding-right: 2.5rem; }
.input-icon-btn {
    position: absolute;
    right: .5rem; top: 50%;
    transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: .9rem;
    padding: .2rem;
    transition: var(--trans);
}
.input-icon-btn:hover { color: var(--text-primary); }

/* Checkbox / Radio */
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.form-check-label { font-size: .875rem; color: var(--text-secondary); cursor: pointer; }

/* ── Alerts / Notices ──────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 1rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: .1rem; }

.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.25); color: #4ade80; }
.alert-error   { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25); color: #f87171; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); color: #fbbf24; }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.25); color: #60a5fa; }

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%; max-width: 560px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(.97);
    transition: transform .2s;
}
.modal-overlay.open .modal { transform: none; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.2rem;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--trans);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex; gap: .75rem; justify-content: flex-end;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }

.tab-btn {
    padding: .6rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--trans);
    white-space: nowrap;
    margin-bottom: -1px;
    font-family: var(--font-sans);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Ticket Timeline ───────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.25rem;
    position: relative;
}
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 15px; top: 32px; bottom: 0;
    width: 1px;
    background: var(--border);
}

.timeline-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    z-index: 1;
}
.timeline-dot.teal { border-color: var(--teal-500); background: rgba(20,184,166,.1); }
.timeline-dot.indigo { border-color: var(--indigo-500); background: rgba(99,102,241,.1); }

.timeline-content { flex: 1; min-width: 0; }
.timeline-header { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .35rem; flex-wrap: wrap; }
.timeline-author { font-weight: 600; font-size: .875rem; color: var(--text-primary); }
.timeline-time { font-size: .75rem; color: var(--text-muted); }
.timeline-tag { font-size: .7rem; background: var(--bg-elevated); border: 1px solid var(--border); padding: .1rem .4rem; border-radius: 4px; color: var(--text-muted); }
.timeline-body {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-size: .875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.timeline-body.internal {
    border-color: rgba(168,85,247,.3);
    background: rgba(168,85,247,.05);
}

/* ── SLA Progress ──────────────────────────────────────────── */
.sla-bar { width: 100%; height: 6px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.sla-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.sla-fill.ok      { background: var(--green); }
.sla-fill.warning { background: var(--yellow); }
.sla-fill.danger  { background: var(--red); }

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-bar { width: 100%; height: 8px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--accent-gradient); transition: width .4s; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }
.empty-title { font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; }
.empty-text { font-size: .875rem; max-width: 320px; }

/* ── Quick Action Buttons (Dashboard) ─────────────────────── */
.quick-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .875rem 1.1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--trans);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 500;
    min-width: 90px;
    text-align: center;
}
.quick-action-btn:hover {
    background: var(--bg-active);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.quick-action-icon { font-size: 1.4rem; }

/* ── Renewal Warning ───────────────────────────────────────── */
.renewal-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}
.renewal-item:last-child { border-bottom: none; }
.renewal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.renewal-dot.urgent  { background: var(--red); box-shadow: 0 0 6px var(--red); }
.renewal-dot.warning { background: var(--yellow); }
.renewal-dot.ok      { background: var(--green); }
.renewal-info { flex: 1; min-width: 0; }
.renewal-name { font-size: .875rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.renewal-client { font-size: .75rem; color: var(--text-muted); }
.renewal-days { font-size: .8rem; font-weight: 600; flex-shrink: 0; }
.renewal-days.urgent  { color: var(--red); }
.renewal-days.warning { color: var(--yellow); }

/* ── Dropdown ──────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .15s, transform .15s;
}
.dropdown.open .dropdown-menu { opacity: 1; pointer-events: all; transform: none; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1rem;
    font-size: .875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--trans);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.1); color: var(--red); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: .25rem 0; }

/* ── Filters Bar ───────────────────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: .4rem; }
.filter-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .38rem .65rem;
    font-size: .825rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--trans);
}
.filter-select:focus { border-color: var(--accent); }

.search-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .38rem .75rem;
    font-size: .825rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--trans);
    font-family: var(--font-sans);
    min-width: 200px;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filters-count { margin-left: auto; font-size: .8rem; color: var(--text-muted); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.pagination-info { font-size: .8rem; color: var(--text-muted); margin-right: auto; }
.page-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: .825rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--trans);
    text-decoration: none;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Utility ───────────────────────────────────────────────── */
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--green); }
.text-warning   { color: var(--yellow); }
.text-danger    { color: var(--red); }
.text-info      { color: var(--blue); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.fs-sm  { font-size: .8rem; }
.fs-xs  { font-size: .75rem; }
.font-mono { font-family: var(--font-mono); }

.d-flex      { display: flex; }
.align-center{ align-items: center; }
.gap-sm      { gap: .5rem; }
.gap-md      { gap: 1rem; }
.justify-between { justify-content: space-between; }
.ms-auto     { margin-left: auto; }
.mb-0        { margin-bottom: 0; }
.mt-1        { margin-top: .5rem; }
.mt-2        { margin-top: 1rem; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}
.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: .875rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: flex-start; gap: .75rem;
    font-size: .875rem;
    min-width: 280px; max-width: 380px;
    pointer-events: all;
    animation: toast-in .25s ease forwards;
    border-left: 3px solid var(--accent);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
@keyframes toast-in { from { transform: translateX(100%); opacity:0; } to { transform:none; opacity:1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity:0; } }

/* ── Mobile Overlay (sidebar) ──────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .grid-main-side, .grid-aside-main { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }

    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.open { transform: none; }
    .sidebar-overlay.open { display: block; }

    .main { margin-left: 0; }
    .topbar-toggle { display: flex; }
    .topbar-search { display: none; }

    .content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .modal { margin: .5rem; }
}

/* ── Print Styles ──────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .page-actions, .btn { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ddd; box-shadow: none; }
    table thead th { background: #f5f5f5; color: #333; }
}

.text-right { text-align: right; }
.text-center { text-align: center; }
