/* ─── Variables ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:          #0d1117;
    --bg2:         #0a0e14;
    --surface:     #161b22;
    --surface2:    #1c2128;
    --border:      #21262d;
    --border2:     #30363d;
    --text:        #e6edf3;
    --text2:       #c9d1d9;
    --muted:       #8b949e;
    --muted2:      #6e7681;
    --accent:      #58a6ff;
    --accent2:     #1f6feb;
    --success:     #3fb950;
    --error:       #f85149;
    --warning:     #d29922;
    --purple:      #bc8cff;
    --cyan:        #39d353;
    --sidebar-w:   240px;
    --topbar-h:    56px;
    --radius:      10px;
    --radius-lg:   14px;
    --shadow:      0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.4);
    --font:        'DM Sans', -apple-system, sans-serif;
    --font-display:'Outfit', sans-serif;
    --font-mono:   'JetBrains Mono', monospace;
    --transition:  0.18s ease;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--surface2); padding: 1px 6px; border-radius: 4px; }
pre code { background: none; padding: 0; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 100;
    transition: transform var(--transition), width var(--transition);
    overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-toggle { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-icon { margin: 0; }

.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left var(--transition);
}
.main-wrapper.sidebar-collapsed { margin-left: 56px; }
.main-content { padding: 24px; flex: 1; max-width: 1400px; width: 100%; }

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-h);
}
.logo-icon { font-size: 22px; flex-shrink: 0; }
.logo-text { font-family: var(--font-display); font-size: 16px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.sidebar-toggle {
    margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 18px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--border); color: var(--text); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.nav-section { padding: 4px 0 8px; }
.nav-section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted2); padding: 8px 16px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; color: var(--muted); font-size: 13px; font-weight: 500;
    border-radius: 0; cursor: pointer; transition: all var(--transition);
    position: relative; white-space: nowrap;
}
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface2); color: var(--text); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.nav-item-muted { opacity: 0.6; font-size: 12px; }
.nav-icon { font-size: 16px; width: 20px; flex-shrink: 0; text-align: center; }
.nav-badge {
    margin-left: auto; background: var(--accent2); color: #fff;
    font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; min-width: 20px; text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 12px;
    display: flex; align-items: center; gap: 8px;
}
.user-menu { display: flex; align-items: center; gap: 8px; flex: 1; color: var(--text); text-decoration: none; padding: 6px; border-radius: 8px; transition: background var(--transition); min-width: 0; }
.user-menu:hover { background: var(--surface); text-decoration: none; }
.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.logout-btn { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 6px; border-radius: 6px; flex-shrink: 0; transition: all var(--transition); }
.logout-btn:hover { background: var(--error); color: #fff; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

.topbar-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 12px; color: var(--muted); font-size: 13px; min-width: 200px; cursor: pointer;
}
.topbar-search input { background: none; border: none; color: var(--text); outline: none; width: 100%; font-size: 13px; font-family: var(--font); cursor: pointer; }
.topbar-search input::placeholder { color: var(--muted); }

.notif-btn { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; position: relative; padding: 4px 8px; border-radius: 6px; }
.notif-btn:hover { background: var(--surface); color: var(--text); }
.notif-badge { position: absolute; top: 0; right: 0; background: var(--error); color: #fff; font-size: 10px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.notif-panel {
    position: fixed; top: var(--topbar-h); right: 16px;
    width: 320px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 200;
    max-height: 400px; overflow: hidden; display: flex; flex-direction: column;
}
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.notif-list { overflow-y: auto; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bc-item { color: var(--muted); }
.bc-item:hover { color: var(--text); }
.bc-current { color: var(--text); font-weight: 500; }
.bc-sep { color: var(--border2); }

/* ─── Search Overlay ─────────────────────────────────────────────────────── */
.search-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 80px;
}
.search-modal { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-lg); width: 100%; max-width: 600px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-input { width: 100%; padding: 16px 20px; background: none; border: none; color: var(--text); font-size: 16px; outline: none; font-family: var(--font); border-bottom: 1px solid var(--border); }
.search-results { max-height: 400px; overflow-y: auto; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.search-result-item:hover { background: var(--surface2); }
.search-result-id { font-family: var(--font-mono); font-size: 12px; color: var(--muted); min-width: 80px; }
.search-result-title { flex: 1; font-size: 13px; }
.search-no-results { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: 1px solid transparent; transition: all var(--transition);
    font-family: var(--font); text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #0d1117; border-color: var(--accent); }
.btn-primary:hover { background: #79b8ff; border-color: #79b8ff; }
.btn-ghost { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-ghost:hover { background: var(--border); border-color: var(--border2); }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; font-family: var(--font); padding: 0; }
.link-btn:hover { text-decoration: underline; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg2);
}
.card-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.card-body { padding: 20px; }
.table-card { margin-bottom: 0; }

/* ─── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; text-align: center; cursor: pointer; text-decoration: none; color: var(--text);
    transition: all var(--transition); display: block;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-blue { border-left: 3px solid var(--accent); }
.stat-blue .stat-value { color: var(--accent); }
.stat-yellow { border-left: 3px solid var(--warning); }
.stat-yellow .stat-value { color: var(--warning); }
.stat-red { border-left: 3px solid var(--error); }
.stat-red .stat-value { color: var(--error); }
.stat-green { border-left: 3px solid var(--success); }
.stat-green .stat-value { color: var(--success); }
.stat-purple { border-left: 3px solid var(--purple); }
.stat-purple .stat-value { color: var(--purple); }
.stat-cyan { border-left: 3px solid var(--cyan); }
.stat-cyan .stat-value { color: var(--cyan); }

/* ─── Dashboard Grid ─────────────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
.dashboard-right { display: flex; flex-direction: column; gap: 20px; }

/* ─── Ticket Lists ───────────────────────────────────────────────────────── */
.ticket-list { }
.ticket-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 20px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background var(--transition); color: var(--text); text-decoration: none;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--surface2); text-decoration: none; color: var(--text); }
.ticket-row-sm { padding: 10px 20px; }
.ticket-left { min-width: 0; flex: 1; }
.ticket-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ticket-id { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.ticket-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; padding: 2px 8px;
    border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: #3fb95020; color: var(--success); border: 1px solid #3fb95040; }
.badge-muted { background: var(--border); color: var(--muted); }
.badge-internal { background: #bc8cff20; color: var(--purple); border: 1px solid #bc8cff40; }
.type-badge { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-group { }
.filter-input, .filter-select {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); padding: 7px 12px; font-size: 13px; font-family: var(--font); outline: none;
    transition: border-color var(--transition);
}
.filter-input:focus, .filter-select:focus { border-color: var(--accent); }
.filter-input { min-width: 200px; }

/* ─── Data Table ─────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); background: var(--bg2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table-row { cursor: pointer; transition: background var(--transition); }
.table-row:hover { background: var(--surface2); }
.ticket-id-badge { font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; border: 1px solid; border-radius: 6px; white-space: nowrap; }
.ticket-title-cell { }
.tt-title { display: block; font-weight: 500; }
.tt-project { display: block; font-size: 11px; margin-top: 2px; }
.assignee-chip { background: var(--surface2); padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 20px; }
.page-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 7px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: all var(--transition); text-decoration: none; }
.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-info { font-size: 13px; color: var(--muted); }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.3px; text-transform: uppercase; }
.label-link { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--accent); }
.required { color: var(--error); }
.form-control {
    width: 100%; padding: 9px 14px;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-family: var(--font); font-size: 14px; outline: none;
    transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--muted2); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.form-check input { width: auto; }
.input-pw-wrap { position: relative; }
.input-pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px; }

/* ─── Form Tabs ──────────────────────────────────────────────────────────── */
.form-tabs { margin-bottom: 16px; }
.tab-nav { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 8px 8px 0 0; transition: all var(--transition); font-family: var(--font); border-bottom: 2px solid transparent; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Button Group Select ─────────────────────────────────────────────────── */
.btn-group-select { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-option {
    padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
    cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-option:hover { border-color: var(--border2); color: var(--text); }
.btn-option.active { background: var(--accent); color: #0d1117; border-color: var(--accent); }
.priority-critical.active { background: var(--error); border-color: var(--error); }
.priority-high.active { background: #f85149; border-color: #f85149; }
.priority-medium.active { background: var(--warning); border-color: var(--warning); }
.priority-low.active { background: var(--success); border-color: var(--success); }

/* ─── Form Layout ────────────────────────────────────────────────────────── */
.form-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.form-main { }
.form-sidebar { position: sticky; top: calc(var(--topbar-h) + 16px); }
.form-actions { display: flex; flex-direction: column; gap: 8px; }

/* ─── Upload Zone ────────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border2); border-radius: 10px; padding: 24px;
    text-align: center; cursor: pointer; transition: all var(--transition);
    background: var(--bg2);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: rgba(88,166,255,0.05); }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--muted); }
.upload-link { color: var(--accent); }
.upload-hint { font-size: 11px; margin-top: 4px; }
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preview-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 6px 10px; max-width: 200px; }
.preview-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.preview-icon { font-size: 24px; }
.preview-info { font-size: 11px; min-width: 0; }
.preview-info span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-info small { color: var(--muted); }
.preview-tag { background: var(--surface2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; font-size: 11px; color: var(--muted); }
.upload-zone-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); transition: all var(--transition); }
.upload-zone-mini:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Ticket View ─────────────────────────────────────────────────────────── */
.ticket-view-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: start; }
.ticket-main { min-width: 0; }
.ticket-sidebar { position: sticky; top: calc(var(--topbar-h) + 16px); }
.ticket-header-card .card-body, .ticket-header-card { padding: 20px; }
.ticket-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.ticket-header-id { display: flex; align-items: center; gap: 10px; }
.ticket-id-large { font-family: var(--font-mono); font-size: 12px; padding: 4px 10px; border: 1px solid; border-radius: 6px; }
.ticket-header-actions { display: flex; gap: 8px; }
.ticket-view-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 10px; }
.ticket-view-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.prose { line-height: 1.8; color: var(--text2); }
.repro-section { margin-bottom: 20px; }
.repro-section:last-child { margin-bottom: 0; }
.repro-section h4 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.repro-content { background: var(--bg2); border-radius: 8px; padding: 12px 16px; font-size: 13px; line-height: 1.7; border-left: 3px solid var(--border2); }
.repro-error { border-left-color: var(--error); }
.env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.env-item { background: var(--bg2); border-radius: 8px; padding: 10px 12px; }
.env-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted2); margin-bottom: 3px; }
.env-value { font-size: 13px; font-weight: 500; }

/* ─── Attachments ─────────────────────────────────────────────────────────── */
.attachment-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.attachment-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; width: 160px; }
.attachment-preview { display: block; height: 100px; overflow: hidden; background: var(--bg); }
.attachment-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition); }
.attachment-preview:hover img { transform: scale(1.05); }
.file-preview { display: flex; align-items: center; justify-content: center; }
.file-icon { font-size: 40px; }
.attachment-info { padding: 8px 10px; }
.attachment-name { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-size { font-size: 10px; color: var(--muted); }
.comment-img { max-width: 200px; max-height: 120px; border-radius: 6px; border: 1px solid var(--border); }
.comment-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment-link { font-size: 12px; color: var(--accent); }

/* ─── Detail Row (Ticket sidebar) ─────────────────────────────────────────── */
.detail-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 8px; font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.inline-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12px; padding: 3px 8px; font-family: var(--font); outline: none; cursor: pointer; }

/* ─── Comments ───────────────────────────────────────────────────────────── */
.comments-list { }
.comment { display: flex; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.comment-internal { background: rgba(188,140,255,0.04); border-left: 3px solid var(--purple); }
.comment:last-child { border-bottom: none; }
.comment-avatar img { width: 36px; height: 36px; border-radius: 50%; }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.comment-content { font-size: 13px; line-height: 1.7; color: var(--text2); }
.comments-empty { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }
.comment-form { padding: 20px; border-top: 1px solid var(--border); background: var(--bg2); }
.comment-form-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.comment-form-footer { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.internal-toggle { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ─── Activity ───────────────────────────────────────────────────────────── */
.activity-list { padding: 8px 0; }
.activity-item { display: flex; gap: 10px; padding: 8px 20px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border2); flex-shrink: 0; margin-top: 6px; }
.activity-content { font-size: 12px; color: var(--muted); flex: 1; }
.activity-content strong { color: var(--text); }
.activity-time { display: block; font-size: 10px; margin-top: 2px; color: var(--muted2); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 1000;
    background: var(--surface2); border: 1px solid var(--border2); border-radius: 10px;
    padding: 12px 20px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
    animation: slideIn 0.2s ease;
}
.toast-success { border-color: var(--success); color: var(--success); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.alert-error { background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.3); color: var(--error); }
.alert-success { background: rgba(63,185,80,0.1); border: 1px solid rgba(63,185,80,0.3); color: var(--success); }
.alert-info { background: rgba(88,166,255,0.1); border: 1px solid rgba(88,166,255,0.3); color: var(--accent); }

/* ─── Avatar ─────────────────────────────────────────────────────────────── */
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ─── Auth ───────────────────────────────────────────────────────────────── */
.auth-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { font-size: 48px; margin-bottom: 8px; }
.auth-logo h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--accent); }
.auth-logo p { color: var(--muted); font-size: 13px; }
.auth-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border2); border-radius: 16px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--border); }
.modal form { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ─── Plugin Grid ─────────────────────────────────────────────────────────── */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 20px; }
.plugin-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px; display: flex; align-items: flex-start; gap: 14px; transition: all var(--transition);
}
.plugin-card:hover { border-color: var(--border2); }
.plugin-active { border-color: rgba(88,166,255,0.3); background: rgba(88,166,255,0.03); }
.plugin-icon { font-size: 28px; flex-shrink: 0; }
.plugin-info { flex: 1; min-width: 0; }
.plugin-name { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.plugin-version { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.plugin-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.plugin-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* ─── Settings Grid ──────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); font-size: 13px; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .ticket-view-layout { grid-template-columns: 1fr; }
    .ticket-sidebar { position: static; }
    .form-layout { grid-template-columns: 1fr; }
    .form-sidebar { position: static; }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-100%); width: 240px; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .topbar-search { display: none; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 16px; }
    .filter-form { flex-direction: column; }
    .filter-input, .filter-select { width: 100%; }
    .plugin-grid { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .env-grid { grid-template-columns: 1fr; }
    .btn-group-select { }
}

/* ─── Microsoft SSO Button ──────────────────────────────────────────────────── */
.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 11px 20px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 16px;
}
.btn-microsoft:hover {
    background: #f5f5f5;
    border-color: #bbb;
    text-decoration: none;
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}
