:root {
    color-scheme: light;
    --brand-primary: #1f6fff;
    --brand-dark: #0f172a;
    --brand-light: #f8f9ff;
    --brand-accent: #60a5fa;

    /* UI tokens */
    --ui-bg: var(--brand-light);
    --ui-surface: #ffffff;
    --ui-surface-2: #ffffff;
    --ui-text: #0f172a;
    --ui-muted: #64748b;
    --ui-border: rgba(148, 163, 184, 0.35);
}

body.theme-dark {
    color-scheme: dark;
    --ui-bg: #0b1220;
    --ui-surface: #111827;
    --ui-surface-2: #0f172a;
    --ui-text: #e5e7eb;
    --ui-muted: rgba(229, 231, 235, 0.7);
    --ui-border: rgba(148, 163, 184, 0.18);
}

.btn:not(.btn-danger):not(.btn-outline-danger):not(.btn-warning):not(.btn-outline-warning):not(.btn-success):not(.btn-outline-success) {
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--brand-accent);
    --bs-btn-hover-border-color: var(--brand-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-primary);
    --bs-btn-active-border-color: var(--brand-primary);
}

.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-light,
.btn-outline-primary {
    --bs-btn-bg: transparent;
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-hover-color: #fff;
}

* {
    font-family: 'Inter', sans-serif;
}

.bg-gradient {
    background: linear-gradient(135deg, #e2ecff 0%, #fef6ff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-shell {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    width: 100%;
}

.auth-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
}

.auth-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.auth-brand h1 {
    font-size: 1.75rem;
    margin: 0;
}

.auth-brand p {
    margin: 0.25rem 0 0;
    color: #64748b;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 700;
    letter-spacing: 1px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    padding: 6px;
}

.auth-form .form-control {
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

.auth-form .btn-primary {
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    background: var(--brand-primary);
    border: none;
}

.auth-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.9rem;
}

.auth-highlight {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    padding: 2.5rem;
    display: flex;
    align-items: center;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

/* --- Login page (new split layout) --- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.login-shell {
    width: 100%;
    max-width: 1100px;
}

.login-card {
    background: #ffffff;
    border-radius: 26px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    min-height: 560px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22);
}

.login-left {
    position: relative;
    padding: 3rem 3.25rem;
    color: #ffffff;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 55%),
        linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-accent) 100%);
    background-size: cover;
    background-position: center;
}

.login-left-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.15) 0%, rgba(15, 23, 42, 0.45) 100%);
}

.login-left-content {
    position: relative;
    max-width: 420px;
}

.login-left-content h1 {
    font-size: 2.4rem;
    font-weight: 800;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.login-left-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.6;
}

.login-right {
    padding: 3rem 3.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.login-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    padding: 6px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.login-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
}

.login-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, 0.85);
    font-weight: 600;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-top: 0.25rem;
    color: var(--brand-dark);
}

.login-form .form-control {
    border-radius: 14px;
    padding: 0.85rem 1rem;
}

.login-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.25rem 0 1.5rem;
}

.login-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

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

.login-form .btn-primary {
    border-radius: 14px;
    padding: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    border: none;
}

.login-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: #64748b;
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 991px) {
    .login-card {
        grid-template-columns: 1fr;
        min-height: unset;
    }

    .login-left {
        padding: 2.5rem 2.25rem;
    }

    .login-right {
        padding: 2.5rem 2.25rem;
    }
}

@media (max-width: 520px) {
    .login-row,
    .login-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-left-content h1 {
        font-size: 2rem;
    }
}

.auth-highlight h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--brand-dark);
}

.auth-highlight ul {
    padding-left: 1.2rem;
    color: #475569;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    background: var(--ui-bg);
}

.sidebar {
    background: #0f172a;
    color: #fff;
    padding: 2rem 1.5rem;
}

.sidebar-brand {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.5rem;
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-section {
    margin-top: 0.75rem;
}

.nav-section-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
}

.nav-section-toggle:hover,
.nav-section-toggle:focus-visible {
    color: #fff;
}

.nav-section-title {
    letter-spacing: 0.08em;
    font-size: 0.65rem;
}

.sidebar .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.nav-section-chevron {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.nav-submenu {
    margin-top: 0.5rem;
    display: none;
}

.nav-section.is-open .nav-submenu {
    display: block;
}

.nav-section.is-open .nav-section-chevron {
    transform: rotate(180deg);
}

.content {
    padding: 2.5rem 3rem 3rem;
}

body.theme-dark .content {
    color: var(--ui-text);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h1 {
    margin-bottom: 0.25rem;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: var(--ui-surface);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    border: 1px solid transparent;
}

body.theme-dark .metric-card {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    border-color: var(--ui-border);
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.metric-sub {
    color: #64748b;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.panel {
    background: var(--ui-surface);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
    border: 1px solid transparent;
}

body.theme-dark .panel {
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
    border-color: var(--ui-border);
}

.panel h2 {
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-header p {
    margin-bottom: 0;
    color: #64748b;
}

.comment-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.comment-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-meta {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.photo-stack {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.photo-stack img,
.thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
}

.scrollable-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.table-sticky-actions th:last-child,
.table-sticky-actions td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -6px 0 12px rgba(15, 23, 42, 0.08);
}

.table-sticky-actions th:last-child {
    z-index: 2;
}

.inventory-table {
    min-width: 1400px;
}

.panel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.panel-item:last-child {
    border-bottom: none;
}

.config-list {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.config-list:last-child {
    border-bottom: none;
}

.notification {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.notification:last-child {
    border-bottom: none;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
}

.status-dot.warning {
    background: #fbbf24;
}

.status-dot.success {
    background: #22c55e;
}

.highlight-banner {
    background: linear-gradient(120deg, rgba(31, 111, 255, 0.12), rgba(96, 165, 250, 0.2));
    padding: 1.5rem;
    border-radius: 18px;
    margin-bottom: 2rem;
}

.highlight-banner p {
    margin: 0.4rem 0 0;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--brand-primary);
}

.timeline-content {
    flex: 1;
    background: #f8fafc;
    border-radius: 16px;
    padding: 0.9rem 1rem;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.ticket-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-panel {
    background: #ffffff;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.ticket-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.ticket-form .form-label {
    font-weight: 600;
    color: #475569;
}

.ticket-form .form-control,
.ticket-form .form-select {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
    border-radius: 12px;
}

.ticket-form .form-control:focus,
.ticket-form .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.timer-card {
    background: #0f172a;
    color: #fff;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
}

.timer-progress {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.timer-progress svg {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.timer-progress-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 10;
}

.timer-progress-value {
    fill: none;
    stroke: #38bdf8;
    stroke-linecap: round;
    stroke-width: 10;
    transition: stroke-dashoffset 0.4s ease;
}

.timer-card .timer-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.timer-card .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.contact-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
}

.contact-card span {
    display: block;
    margin-top: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

@media (max-width: 992px) {
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* Lottie modal (notifications + loader) */
.portal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(4px);
}

.portal-modal-overlay.is-visible {
  display: flex;
}

.portal-modal-overlay.is-loading {
  background: rgba(248, 249, 255, 0.82);
}

.portal-modal-card {
  width: min(420px, calc(100vw - 2rem));
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  opacity: 0;
  transform: translateY(6px);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.portal-modal-overlay.is-visible .portal-modal-card {
  opacity: 1;
  transform: translateY(0);
}

.portal-modal-animation {
  width: 92px;
  height: 92px;
  margin: 0 auto 0.35rem;
}

.portal-modal-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  color: var(--brand-dark);
}

.portal-modal-message {
  margin: 0;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.35rem;
  max-width: 34ch;
}

/* --- Dark mode tweaks (Admin UI) --- */
body.theme-dark .content-header p,
body.theme-dark .metric-sub {
    color: var(--ui-muted);
}

body.theme-dark .table {
    color: var(--ui-text);
}

body.theme-dark .table > :not(caption) > * > * {
    background-color: transparent;
    border-color: var(--ui-border);
    color: inherit;
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    background-color: var(--ui-surface-2);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

body.theme-dark .form-control::placeholder {
    color: rgba(229, 231, 235, 0.55);
}

body.theme-dark .modal-content,
body.theme-dark .dropdown-menu {
    background-color: var(--ui-surface);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

body.theme-dark .portal-modal-card {
    background: rgba(17, 24, 39, 0.96);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

body.theme-dark .portal-modal-title {
    color: var(--ui-text);
}

body.theme-dark .portal-modal-message {
    color: var(--ui-muted);
}
