/* ============================================================
   Suisse IT Ticketing — Professional SaaS UI
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    --color-primary: #2563eb;
    --color-primary-light: #3b82f6;
    --color-primary-dark: #1d4ed8;
    --color-success: #059669;
    --color-success-light: #d1fae5;
    --color-warning: #d97706;
    --color-warning-light: #fef3c7;
    --color-danger: #dc2626;
    --color-danger-light: #fee2e2;
    --color-info: #0891b2;
    --color-info-light: #cffafe;

    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active-bg: #334155;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #f1f5f9;
    --sidebar-accent: var(--color-primary);
    --sidebar-width: 240px;

    --topbar-height: 56px;
    --topbar-bg: #ffffff;
    --topbar-border: #e2e8f0;

    --body-bg: #f8fafc;
    --content-bg: #ffffff;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    --border-radius-sm: 0.375rem;
    --border-radius-lg: 0.75rem;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji";
    --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono",
        monospace;
}

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

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--body-bg);
    line-height: 1.6;
    min-height: 100vh;
}

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

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--sidebar-hover);
    border-radius: 4px;
}

/* ---- Sidebar header (brand) ---- */
.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.sidebar-brand:hover {
    color: #ffffff;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

/* ---- Sidebar section labels ---- */
.sidebar-section {
    padding: 1.25rem 1.25rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ---- Navigation ---- */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav-item {
    margin: 1px 0.5rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--sidebar-text);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
    white-space: nowrap;
}

.sidebar-nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

.sidebar-nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-nav-link.active i,
.sidebar-nav-link:hover i {
    opacity: 1;
}

.sidebar-nav-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    line-height: 1.4;
    min-width: 1.25rem;
    text-align: center;
}

/* ---- Sidebar footer ---- */
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem;
    border-radius: var(--border-radius-sm);
    transition: background 0.15s;
}

.sidebar-user:hover {
    background: var(--sidebar-hover);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sidebar-text-active);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: var(--sidebar-text-active);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--text-muted);
    font-size: 0.6875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout {
    color: var(--sidebar-text);
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logout:hover {
    color: var(--color-danger);
    background: rgba(220, 38, 38, 0.1);
    text-decoration: none;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius-sm);
    line-height: 1;
}

.sidebar-toggle:hover {
    background: var(--body-bg);
    color: var(--text-primary);
}

/* ---- Topbar search ---- */
.topbar-search {
    flex: 1;
    max-width: 400px;
}

.topbar-search-input {
    width: 100%;
    padding: 0.4375rem 0.75rem 0.4375rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.8125rem;
    background: var(--body-bg);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 0.875rem;
}

.topbar-search-input::placeholder {
    color: var(--text-muted);
}

.topbar-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #fff;
}

/* ---- Topbar right actions ---- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    font-size: 1.125rem;
    transition: background 0.15s, color 0.15s;
}

.topbar-btn:hover {
    background: var(--body-bg);
    color: var(--text-primary);
}

.topbar-btn .notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--topbar-bg);
}

/* ---- Topbar language switcher ---- */
.topbar-lang {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.375rem 0.625rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.topbar-lang:hover {
    background: var(--body-bg);
    color: var(--text-primary);
}

/* ---- Topbar user dropdown ---- */
.topbar-user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: var(--border-radius);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
}

.topbar-user-toggle:hover {
    background: var(--body-bg);
}

.topbar-user-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.topbar-user-name {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 100%;
}

.main-content > .container-fluid {
    max-width: 1400px;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb-wrapper {
    padding: 0.75rem 1.5rem;
    background: transparent;
}

.breadcrumb {
    margin: 0;
    padding: 0;
    background: none;
    font-size: 0.8125rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
    content: "\203A";
    font-size: 1rem;
    line-height: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease;
}

.card:hover {
    /* No transform - keep it professional */
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
}

/* ---- Stat cards ---- */
.stat-card {
    border-left: 4px solid var(--border-color);
    border-radius: var(--border-radius);
}

.stat-card.stat-primary   { border-left-color: var(--color-primary); }
.stat-card.stat-success   { border-left-color: var(--color-success); }
.stat-card.stat-warning   { border-left-color: var(--color-warning); }
.stat-card.stat-danger    { border-left-color: var(--color-danger); }
.stat-card.stat-info      { border-left-color: var(--color-info); }

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

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.125rem;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    opacity: 0.3;
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
    border-bottom-color: var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom-width: 1px;
    background: var(--body-bg);
}

.table td {
    vertical-align: middle;
    color: var(--text-primary);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(37, 99, 235, 0.02);
}

.table-hover tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

/* ============================================================
   BADGES — Status
   ============================================================ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25em 0.625em;
    border-radius: 10px;
    letter-spacing: 0.01em;
}

/* Status badges */
.badge-new        { background-color: #e2e8f0; color: #475569; }
.badge-open       { background-color: #dbeafe; color: #1e40af; }
.badge-in_progress { background-color: #e0f2fe; color: #0369a1; }
.badge-waiting    { background-color: #fef3c7; color: #92400e; }
.badge-resolved   { background-color: #d1fae5; color: #065f46; }
.badge-closed     { background-color: #f1f5f9; color: #64748b; }

/* Priority badges */
.badge-low      { background-color: #d1fae5; color: #065f46; }
.badge-medium   { background-color: #dbeafe; color: #1e40af; }
.badge-high     { background-color: #fed7aa; color: #9a3412; }
.badge-critical { background-color: #fee2e2; color: #991b1b; }

/* Type badges */
.badge-bug      { background-color: #fee2e2; color: #991b1b; }
.badge-feature  { background-color: #ede9fe; color: #5b21b6; }
.badge-support  { background-color: #dbeafe; color: #1e40af; }
.badge-question { background-color: #ccfbf1; color: #115e59; }
.badge-task     { background-color: #e2e8f0; color: #475569; }

/* ============================================================
   PROGRESS BARS — Hour utilization
   ============================================================ */
.progress {
    height: 6px;
    border-radius: 3px;
    background-color: #e2e8f0;
    overflow: hidden;
}

.progress-bar {
    border-radius: 3px;
    transition: width 0.4s ease;
}

.utilization-low .progress-bar   { background-color: var(--color-success); }
.utilization-medium .progress-bar { background-color: var(--color-warning); }
.utilization-high .progress-bar  { background-color: var(--color-danger); }

/* Direct progress bar color classes */
.progress-bar.bg-success { background-color: var(--color-success) !important; }
.progress-bar.bg-warning { background-color: var(--color-warning) !important; }
.progress-bar.bg-danger  { background-color: var(--color-danger) !important; }

/* ============================================================
   SLA INDICATORS
   ============================================================ */
.sla-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
}

.sla-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sla-on-track  .sla-dot { background-color: var(--color-success); }
.sla-warning   .sla-dot { background-color: var(--color-warning); }
.sla-breached  .sla-dot { background-color: var(--color-danger); }

.sla-on-track  { color: var(--color-success); }
.sla-warning   { color: var(--color-warning); }
.sla-breached  { color: var(--color-danger); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-control,
.form-select {
    border-color: var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

/* Required field indicator */
.form-label.requiredField::after,
label.requiredField::after,
.required .form-label::after {
    content: " *";
    color: var(--color-danger);
    font-weight: 600;
}

textarea.form-control {
    min-height: 80px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 0.4375rem 1rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-sm {
    font-size: 0.8125rem;
    padding: 0.3125rem 0.75rem;
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.alert {
    border-radius: var(--border-radius-sm);
    border: none;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success { background: var(--color-success-light); color: #065f46; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }
.alert-danger  { background: var(--color-danger-light);  color: #991b1b; }
.alert-info    { background: var(--color-info-light);    color: #0e7490; }

.messages-container {
    padding: 0 1.5rem;
    padding-top: 1rem;
}

.messages-container .alert {
    max-width: 1400px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9375rem;
    margin: 0;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

/* ============================================================
   COMMENT STYLES
   ============================================================ */
.comment-internal {
    background-color: #fffbeb;
    border-left: 3px solid var(--color-warning);
}

.comment-public {
    border-left: 3px solid var(--color-primary);
}

/* ============================================================
   DROPDOWN MENUS (overrides Bootstrap)
   ============================================================ */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.375rem;
    font-size: 0.875rem;
}

.dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.4375rem 0.75rem;
    color: var(--text-primary);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--body-bg);
    color: var(--text-primary);
}

.dropdown-item.active,
.dropdown-item:active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
    font-weight: 600;
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.25rem 0;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 {
    margin: 0;
}

/* ============================================================
   HTMX LOADING
   ============================================================ */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* ============================================================
   LIST GROUP OVERRIDES
   ============================================================ */
.list-group-item {
    border-color: var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.list-group-item-action:hover {
    background: var(--body-bg);
}

/* ============================================================
   FOOTER
   ============================================================ */
.main-footer {
    padding: 1.25rem 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* ============================================================
   NO-SIDEBAR BODY (unauthenticated pages)
   ============================================================ */
body.no-sidebar {
    background: var(--body-bg);
}

/* ============================================================
   UNAUTHENTICATED / PUBLIC LAYOUT
   ============================================================ */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--body-bg);
    padding: 1.5rem;
}

.auth-layout .card {
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.auth-layout .card-body {
    padding: 2rem;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.auth-brand h4 {
    margin-bottom: 0.25rem;
}

.auth-brand p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Wider variant for public submit */
.auth-layout.auth-wide .card {
    max-width: 600px;
}

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.25s;
}

.sidebar-overlay.show {
    opacity: 1;
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .topbar-search {
        display: none;
    }

    .topbar-user-name {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .breadcrumb-wrapper {
        padding: 0.5rem 1rem;
    }

    .messages-container {
        padding: 0.75rem 1rem 0;
    }
}

@media (min-width: 992px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary-custom { color: var(--color-primary) !important; }
.text-success-custom { color: var(--color-success) !important; }
.text-warning-custom { color: var(--color-warning) !important; }
.text-danger-custom  { color: var(--color-danger) !important; }

.bg-primary-subtle { background-color: #eff6ff !important; }
.bg-success-subtle { background-color: #f0fdf4 !important; }
.bg-warning-subtle { background-color: #fffbeb !important; }
.bg-danger-subtle  { background-color: #fef2f2 !important; }

.fw-semibold { font-weight: 600; }
.fs-sm       { font-size: 0.875rem; }
.fs-xs       { font-size: 0.75rem; }

.gap-0  { gap: 0 !important; }
.gap-xs { gap: 0.25rem !important; }

/* Table link style — no underline, dark text */
.table-link {
    color: var(--text-primary);
    font-weight: 500;
}

.table-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* Reference monospace */
.ref-code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-primary);
    font-weight: 500;
}

/* Divider with text */
.divider-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 1rem 0;
}

.divider-text::before,
.divider-text::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ============================================================
   ATTACHMENT LIST — Displayed on tickets and comments
   ============================================================ */
.attachment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.attachment-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: var(--body-bg);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.attachment-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.attachment-preview {
    width: 100%;
    height: 120px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-icon {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    font-size: 2rem;
}

.attachment-info {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.attachment-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-name:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.attachment-size {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* ============================================================
   DROP ZONE — Drag & drop upload area
   ============================================================ */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
    position: relative;
}

.drop-zone:hover {
    border-color: var(--color-primary);
    background-color: rgba(37, 99, 235, 0.02);
}

.drop-zone-active {
    border-color: var(--color-primary) !important;
    background-color: rgba(37, 99, 235, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* File list inside drop zone */
.drop-zone-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.drop-zone-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.375rem 0.5rem;
    max-width: 220px;
    font-size: 0.8125rem;
}

.drop-zone-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.drop-zone-file-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.drop-zone-file-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.drop-zone-file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.drop-zone-file-size {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.drop-zone-remove {
    flex-shrink: 0;
    padding: 0.125rem 0.25rem;
    line-height: 1;
    font-size: 0.75rem;
}

.drop-zone-remove:hover {
    background-color: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

@media (max-width: 575.98px) {
    .attachment-list {
        grid-template-columns: 1fr;
    }
    .drop-zone {
        padding: 1rem;
    }
}
