/* Theme base */
:root {
    --bg: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.95);
    --border-subtle: rgba(148, 163, 184, 0.25);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --primary: #4f46e5;
    --primary2: #06b6d4;
    --danger-bg: rgba(248, 113, 113, 0.15);
    --danger-border: rgba(248, 113, 113, 0.5);
    --danger-text: #fecaca;
}

body.light-mode {
    --bg: #f3f4f6;
    --bg-card: #ffffff;
    --border-subtle: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --danger-bg: #fee2e2;
    --danger-border: #fecaca;
    --danger-text: #b91c1c;
}

/* Global reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
}

/* Theme toggle */
.theme-toggle {
    border: 1px solid #4b5563;
    border-radius: 999px;
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    background: transparent;
    color: var(--text-main);
}
.theme-toggle:hover {
    background: rgba(107, 114, 128, 0.25);
}

/* Centered auth layout */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-subtle);
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input,
textarea,
select {
    width: 100%;
    padding: 10px 11px;
    border-radius: 10px;
    border: 1px solid #374151;
    background: #020617;
    color: var(--text-main);
    font-size: 14px;
}

body.light-mode .input,
body.light-mode textarea,
body.light-mode select {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.button-primary {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.button-primary:hover {
    opacity: 0.96;
}

.button-secondary {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #4b5563;
    background: transparent;
    color: var(--text-main);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.button-secondary:hover {
    background: rgba(31, 41, 55, 0.9);
}
body.light-mode .button-secondary:hover {
    background: #e5e7eb;
}

/* Messages */
.messages {
    margin-bottom: 16px;
    font-size: 13px;
}
.messages li {
    list-style: none;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
}

/* App layout */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.app-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.app-header-right a {
    color: var(--text-muted);
    text-decoration: none;
}
.app-header-right a:hover {
    color: var(--text-main);
}

.filter-card,
.content-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 16px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th,
.table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(55, 65, 81, 0.9);
    text-align: left;
}
body.light-mode .table th,
body.light-mode .table td {
    border-bottom-color: #e5e7eb;
}
.table th {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.table tbody tr:hover {
    background: rgba(15, 23, 42, 0.7);
}
body.light-mode .table tbody tr:hover {
    background: #eef2ff;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

/* default */
.badge-status {
    background: #4b5563;
    color: #f9fafb;
}

/* status-specific colors */
.badge-status-new {
    background: #1d4ed8;      /* blue */
    color: #eff6ff;
}

.badge-status-open {
    background: #15803d;      /* green */
    color: #ecfdf5;
}

.badge-status-pending {
    background: #ca8a04;      /* amber */
    color: #fef9c3;
}

.badge-status-closed {
    background: #6b7280;      /* gray */
    color: #f9fafb;
}

.badge-status-escalated {
    background: #b91c1c;      /* red */
    color: #fee2e2;
}

.badge-status-inprogress {
    background: #0ea5e9;      /* cyan/sky blue */
    color: #f0f9ff;
}

/* assigned user stays as before */
.badge-user {
    background: #047857;
    color: #ecfdf5;
}

/* Detail/comments */
.section-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
}
.section-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    font-size: 13px;
    margin-bottom: 12px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
}
.detail-value {
    font-size: 14px;
}

.comment-list {
    margin-top: 8px;
}
.comment {
    border-bottom: 1px solid rgba(55, 65, 81, 0.8);
    padding: 8px 0;
    font-size: 13px;
}
.comment-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.comment-text {
    font-size: 13px;
}