/* QURB Portal - Stylesheet */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #00072D;
    --primary-light: #001A5C;
    --primary-dark: #000514;
    --secondary: #f5f5f5;
    --accent: #FF8B00;
    --accent-hover: #E67A00;
    --accent-light: #FFA533;
    --text-primary: #0a0a0a;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --bg: #ffffff;
    --bg-secondary: #fafafa;
    --bg-hover: #f9fafb;
    --bg-main: #f3f4f6;
    --success: #10b981;
    --warning: #FF8B00;
    --danger: #ef4444;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --sidebar-width: 240px;
    --header-height: 64px;
    --sidebar-bg: #00072D;
    --sidebar-text: rgba(255,255,255,0.65);
    --sidebar-text-active: #fff;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(255,255,255,0.1);
}

[data-theme="dark"] {
    --primary: #ffffff;
    --primary-light: #e5e5e5;
    --primary-dark: #00072D;
    --secondary: #1a1a1a;
    --accent: #FF8B00;
    --accent-hover: #FFA533;
    --accent-light: #FFB866;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-light: #9ca3af;
    --border: #374151;
    --border-light: #4b5563;
    --bg: #111827;
    --bg-secondary: #1f2937;
    --bg-hover: #374151;
    --bg-main: #1f2937;
    --success: #10b981;
    --warning: #FF8B00;
    --danger: #ef4444;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px -1px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.5);
    --sidebar-bg: #0d1117;
    --sidebar-text: rgba(255,255,255,0.55);
    --sidebar-text-active: #fff;
    --sidebar-border: rgba(255,255,255,0.06);
    --sidebar-hover: rgba(255,255,255,0.05);
    --sidebar-active-bg: rgba(255,139,0,0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: linear-gradient(135deg, #f8f9fb 0%, #eef0f5 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.login-card {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    height: 36px;
    width: auto;
    margin-bottom: 16px;
}

.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    pointer-events: none;
    flex-shrink: 0;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 139, 0, 0.12);
}

.input-wrapper input::placeholder {
    color: var(--text-light);
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover { color: var(--text-secondary); }

.btn-login {
    width: 100%;
    padding: 13px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s;
    margin-top: 4px;
}

.btn-login:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .login-error {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.login-footer p {
    font-size: 13px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--accent);
    font-weight: 500;
}

.login-branding {
    text-align: center;
    opacity: 0.35;
}

.login-branding .nbo-logo {
    width: 28px;
    height: auto;
}

/* ============================================
   PORTAL LAYOUT
   ============================================ */
.portal-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.portal-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    height: 26px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    color: var(--accent);
    background: var(--sidebar-active-bg);
    border-left-color: var(--accent);
}

.nav-item i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    opacity: 0.7;
}

.nav-item.active i { opacity: 1; }

.sidebar-nbo {
    padding: 10px 20px 4px 20px;
    text-align: center;
    opacity: 0.15;
}

.sidebar-nbo img {
    width: 22px;
    height: auto;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-company {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sidebar-user-link:hover {
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.1); }

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

.portal-header {
    height: var(--header-height);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.portal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.portal-header-sub {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-content {
    flex: 1;
    padding: 24px 28px;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle .fa-moon { display: inline; }
.theme-toggle .fa-sun { display: none; }

[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }

/* Cards */
.portal-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

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

.portal-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.portal-card-header h3 i {
    margin-right: 8px;
    opacity: 0.5;
    font-size: 15px;
}

.portal-card-body {
    padding: 20px;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, #00072D 0%, #001A5C 100%);
    color: #fff;
    border-radius: 14px;
    padding: 32px;
    margin-bottom: 24px;
}

.welcome-section h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-section p {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.stat-icon--primary { background: rgba(0,7,45,0.08); color: #00072D; }
.stat-icon--accent { background: rgba(255,139,0,0.1); color: var(--accent); }
.stat-icon--success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon--warning { background: rgba(245,158,11,0.1); color: #d97706; }

[data-theme="dark"] .stat-icon--primary { background: rgba(255,255,255,0.08); color: #fff; }
[data-theme="dark"] .stat-icon--warning { background: rgba(245,158,11,0.15); color: #fbbf24; }

.stat-info h4 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-accent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.btn-accent:hover { background: var(--accent-hover); }

.btn-accent.btn-sm {
    padding: 7px 14px;
    font-size: 12.5px;
    border-radius: 6px;
}

.btn-secondary-sm {
    padding: 9px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover { color: var(--accent-hover); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 4px;
}

.back-link:hover { color: var(--accent); }

/* ============================================
   DEVICES TABLE
   ============================================ */
.devices-table-wrap { overflow-x: auto; }

.devices-table {
    width: 100%;
    border-collapse: collapse;
}

.devices-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.devices-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.device-code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(255,139,0,0.08);
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.5px;
}

.contact-cell { display: flex; flex-direction: column; gap: 1px; }
.contact-cell-name { font-weight: 500; font-size: 13px; }
.contact-cell-pos { font-size: 11px; color: var(--text-secondary); }
.text-muted { color: var(--text-light); }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge--active { background: #ecfdf5; color: #059669; }
.badge--expiring { background: #fffbeb; color: #d97706; }
.badge--expired { background: #fef2f2; color: #dc2626; }
.badge--waiting { background: #eff6ff; color: #2563eb; }

[data-theme="dark"] .badge--active { background: rgba(5,150,105,0.15); color: #34d399; }
[data-theme="dark"] .badge--expiring { background: rgba(217,119,6,0.15); color: #fbbf24; }
[data-theme="dark"] .badge--expired { background: rgba(220,38,38,0.15); color: #f87171; }
[data-theme="dark"] .badge--waiting { background: rgba(37,99,235,0.15); color: #60a5fa; }

/* Empty State */
.devices-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-light);
}

.devices-empty i { font-size: 40px; opacity: 0.2; margin-bottom: 12px; display: block; }
.devices-empty p { font-size: 14px; }

/* Info Table */
.info-table { width: 100%; border-collapse: collapse; }
.info-table tr + tr td { border-top: 1px solid var(--border-light); }
.info-label { padding: 10px 12px; font-size: 13px; color: var(--text-secondary); width: 160px; }
.info-value { padding: 10px 12px; font-size: 14px; font-weight: 500; }

/* ============================================
   FILTER SELECT
   ============================================ */
.filter-select-sm {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg);
    cursor: pointer;
    outline: none;
}

.filter-select-sm:focus { border-color: var(--accent); }

/* ============================================
   TICKETS LIST
   ============================================ */
.tickets-list { display: flex; flex-direction: column; }

.ticket-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.12s ease;
}

.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--bg-hover); text-decoration: none; }
.ticket-row--closed { opacity: 0.65; }
.ticket-row--closed:hover { opacity: 1; }

.ticket-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    gap: 16px;
}

.ticket-row-subject {
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-id {
    color: var(--text-light);
    font-weight: 600;
    font-size: 12px;
    margin-right: 8px;
}

.ticket-row-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ticket-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-light);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 520px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.modal-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-box-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.modal-box-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-box-close:hover { color: var(--text-primary); }

.modal-box-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-box-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   FORM ELEMENTS (Modal / Tickets)
   ============================================ */
.modal-box-body .form-group { margin-bottom: 16px; }
.modal-box-body .form-group:last-child { margin-bottom: 0; }

.modal-box-body .form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-box-body .form-group input[type="text"],
.modal-box-body .form-group select,
.modal-box-body .form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-box-body .form-group input[type="text"]:focus,
.modal-box-body .form-group select:focus,
.modal-box-body .form-group textarea:focus {
    border-color: var(--accent);
}

.modal-box-body .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-error {
    background: #fef2f2;
    color: #dc2626;
    font-size: 12.5px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
}

[data-theme="dark"] .form-error {
    background: rgba(239,68,68,0.1);
}

.form-error-inline {
    color: #dc2626;
    font-size: 12px;
}

/* ============================================
   TICKET DETAIL LAYOUT
   ============================================ */
.ticket-detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: flex-start;
}

.ticket-detail-title { font-size: 18px !important; }

/* ============================================
   MESSAGES / CONVERSATION
   ============================================ */
.messages-container {
    padding: 20px;
    max-height: calc(100vh - 340px);
    min-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message { display: flex; gap: 10px; max-width: 85%; }
.message--client { margin-left: auto; flex-direction: row-reverse; }
.message--staff { margin-right: auto; }

.message-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
    background: rgba(255,139,0,0.15);
    color: var(--accent);
}

.message-avatar--staff {
    background: rgba(0,7,45,0.08);
    color: #00072D;
}

[data-theme="dark"] .message-avatar--staff {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.message-body { flex: 1; min-width: 0; }

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message--client .message-header {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message-sender { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }

.message-badge-staff {
    font-size: 10px;
    font-weight: 600;
    background: rgba(0,7,45,0.07);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

[data-theme="dark"] .message-badge-staff {
    background: rgba(255,255,255,0.1);
}

.message-time { font-size: 11px; color: var(--text-light); }

.message-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message--client .message-text {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message--staff .message-text {
    background: var(--bg-main);
    border-bottom-left-radius: 4px;
}

/* Reply Box */
.reply-box {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.reply-box textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    resize: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.reply-box textarea:focus { border-color: var(--accent); }

.reply-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.reply-box-closed {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Priority Dot */
.priority-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.priority--low { background: #94a3b8; }
.priority--medium { background: var(--accent); }
.priority--high { background: #ef4444; }
.priority--urgent { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.2); }

/* Pass Reset Page */
.reset-page {
    background: linear-gradient(135deg, #f8f9fb 0%, #eef0f5 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .reset-page {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
}

.reset-card {
    width: 100%; max-width: 440px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.reset-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.reset-card p { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.reset-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }

.reset-success { background: #f0fdf4; color: #15803d; padding: 14px 16px; border-radius: 10px; font-size: 14px; border: 1px solid #bbf7d0; margin-bottom: 16px; }
.reset-error { background: #fef2f2; color: #dc2626; padding: 14px 16px; border-radius: 10px; font-size: 14px; border: 1px solid #fecaca; margin-bottom: 16px; }

[data-theme="dark"] .reset-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); }
[data-theme="dark"] .reset-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }

.btn-reset {
    width: 100%; padding: 13px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background 0.2s;
}

.btn-reset:hover { background: var(--accent-hover); }

/* ============================================
   DEVICES PAGE
   ============================================ */
.device-cards-list {
    display: flex;
    flex-direction: column;
}

.device-card {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.12s;
}

.device-card:last-child { border-bottom: none; }

.device-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0 20px;
    gap: 12px;
}

.device-card-id {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.device-model-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.device-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.device-card-body {
    padding: 12px 20px 16px 20px;
}

.device-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 20px;
}

.device-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-card-field-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.device-card-field-label i {
    font-size: 12px;
    opacity: 0.6;
}

.device-card-field-value {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
}

.device-card-contact {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.device-contact-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
}

.device-contact-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.device-contact-pos {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-main);
    padding: 1px 8px;
    border-radius: 4px;
}

.device-contact-detail {
    font-size: 12.5px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.device-card-notes {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.device-card-notes p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
}

.loc-link {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loc-link:hover {
    text-decoration: underline;
}

/* ============================================
   PROFILE PAGE
   ============================================ */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: flex-start;
}

.profile-info-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--bg-main);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-form .form-group label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.profile-form .input-wrapper input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s;
}

.profile-form .input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,139,0,0.08);
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 2px;
}

.form-msg {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 2px;
}

.form-msg--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.form-msg--error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

[data-theme="dark"] .form-msg--success {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.3);
}

[data-theme="dark"] .form-msg--error {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
}

/* Preference Buttons */
.pref-options {
    display: flex;
    gap: 8px;
}

.pref-btn {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.pref-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.pref-btn--active {
    border-color: var(--accent);
    background: rgba(255,139,0,0.06);
    color: var(--accent);
    font-weight: 600;
}

.pref-flag {
    font-size: 16px;
}

/* Danger Outline Button */
.btn-danger-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

/* ============================================
   CATEGORY BADGES
   ============================================ */
.badge--category {
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 8px;
}
.badge--cat-device {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}
.badge--cat-finance {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}
.badge--cat-technical {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}
.badge--cat-general {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}
[data-theme="dark"] .badge--cat-device { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
[data-theme="dark"] .badge--cat-finance { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
[data-theme="dark"] .badge--cat-technical { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
[data-theme="dark"] .badge--cat-general { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }

/* ============================================
   RESPONSIVE
   ============================================ */
/* Invoice Detail Modal */
.inv-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--bg-hover);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 20px;
}
.inv-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}
.inv-detail-row:nth-last-child(-n+2) { border-bottom: none; }
.inv-detail-label { color: var(--text-muted); font-weight: 500; }
.inv-detail-value { font-weight: 600; color: var(--text-primary); }

.inv-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}
.inv-section-title i { opacity: 0.6; font-size: 14px; }

.inv-totals-box {
    background: var(--sidebar-bg);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    padding: 14px 18px;
    margin: 16px 0;
    max-width: 320px;
    margin-left: auto;
}
.inv-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.inv-totals-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 500; }
.inv-totals-total {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 2px solid var(--border-light);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .ticket-detail-layout { grid-template-columns: 1fr; }
    .ticket-info-side { order: -1; }
    .profile-layout { grid-template-columns: 1fr; }
    .inv-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .portal-sidebar { transform: translateX(-100%); }
    .portal-sidebar.open { transform: translateX(0); }
    .portal-main { margin-left: 0; }
    .portal-content { padding: 16px; }
    .portal-header { padding: 0 16px; }
    .login-card { padding: 28px 20px; }
    .welcome-section { padding: 24px; }
    .stats-grid { grid-template-columns: 1fr; }
    .ticket-row-main { flex-direction: column; align-items: flex-start; gap: 6px; }
    .devices-table thead th, .devices-table tbody td { padding: 10px 12px; font-size: 12px; }
    .info-label { width: 120px; }
}
