@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-main: #f5f5f5;        /* Light Slate */
    --bg-card: #ffffff;        /* White cards */
    --bg-card-hover: #e5e5e5;  /* Light hover */
    --bg-input: #ffffff;       /* White input background */
    --border-color: #d0d0d0;   /* Light border */
    --border-glow: #06b6d4;    /* Cyan Glow */
    
    --text-primary: #111111;   /* Dark text */
    --text-secondary: #333333; /* Medium text */
    --text-muted: #555555;     /* Muted text */
    
    --accent-blue: #3b82f6;    /* Info Blue */
    --accent-blue-glow: rgba(59, 130, 246, 0.15);
    --accent-cyan: #d4af37;    /* Gold Accent */
    --accent-cyan-glow: rgba(212, 175, 55, 0.15);
    --accent-emerald: #10b981; /* Success Green */
    --accent-emerald-glow: rgba(16, 185, 129, 0.15);
    --accent-violet: #8b5cf6;  /* Action Purple */
    --accent-rose: #f43f5e;    /* Danger Red */
    --accent-rose-glow: rgba(244, 63, 94, 0.15);
    --accent-amber: #f59e0b;   /* Warning Yellow */
    --accent-amber-glow: rgba(245, 158, 11, 0.15);
    
    --font-sans: 'Inter', -apple-system, sans-serif;
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Security, manager and break-glass release */
.security-trust-device {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.25rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    cursor: pointer;
}

.security-trust-device input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-cyan);
}

.security-secret,
.security-link-panel {
    display: grid;
    gap: 0.75rem;
}

.security-secret {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.65);
}

.security-secret code {
    display: block;
    padding: 0.8rem;
    overflow-wrap: anywhere;
    letter-spacing: 0.12em;
    color: var(--accent-cyan);
    background: var(--bg-main);
    border-radius: 7px;
}

.manager-dashboard-heading {
    padding: 1.2rem;
    border: 1px solid rgba(198, 172, 69, 0.35);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(198, 172, 69, 0.15), rgba(15, 23, 42, 0.75));
}

.manager-dashboard-heading p {
    color: var(--text-secondary);
    margin: 0.3rem 0 0;
}

.manager-eyebrow {
    color: #d9be58;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    font-weight: 800;
}

.manager-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1rem 0;
}

.manager-kpi {
    display: grid;
    gap: 0.4rem;
    padding: 1rem;
    min-height: 125px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
}

.manager-kpi span,
.manager-kpi small {
    color: var(--text-secondary);
}

.manager-kpi strong {
    color: #d9be58;
    font-size: 2rem;
}

.manager-kpi.alert strong {
    color: var(--accent-rose);
}

.manager-section {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.52);
}

.manager-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.manager-section-title h3 {
    margin: 0;
}

.manager-section-title > span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.manager-task-list,
.manager-calendar-list {
    display: grid;
    gap: 0.7rem;
}

.manager-task-card,
.manager-calendar-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
}

.manager-task-card.overdue {
    border-left: 4px solid var(--accent-rose);
}

.manager-task-card h4,
.manager-calendar-card h4 {
    margin: 0.35rem 0;
}

.manager-task-card p,
.manager-calendar-card p {
    margin: 0.2rem 0;
    color: var(--text-secondary);
}

.manager-calendar-card .manager-calendar-creator {
    color: var(--text-primary);
}

.manager-calendar-card .manager-calendar-creator i {
    width: 1.1rem;
    color: #d9be58;
}

.manager-calendar-card .manager-calendar-creator strong {
    font-weight: 700;
}

.manager-calendar-date {
    min-width: 155px;
    color: #d9be58;
    font-weight: 700;
}

/* Staff-only dispatch scheduling */
.schedule-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(255, 255, 255, 0.9));
}

.schedule-heading h2,
.schedule-heading p { margin: 0.25rem 0; }

.schedule-heading-actions,
.schedule-detail-actions,
.schedule-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.schedule-heading-actions .btn,
.schedule-detail-actions .btn,
.schedule-form-actions .btn { width: auto; }

.schedule-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0 0.7rem;
}

.schedule-view-tabs,
.schedule-range-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.schedule-view-tabs {
    flex-wrap: wrap;
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
}

.schedule-view-tabs button {
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 700;
}

.schedule-view-tabs button.active {
    background: #111;
    color: #fff;
}

.schedule-range-controls strong {
    min-width: 210px;
    text-align: center;
}

.schedule-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 0.65rem;
}

.schedule-main { overflow: hidden; }

.schedule-day-group + .schedule-day-group { margin-top: 1.1rem; }
.schedule-day-group h3 { margin: 0 0 0.6rem; }

.schedule-event-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
    gap: 0.65rem;
}

.schedule-event-card {
    position: relative;
    display: grid;
    gap: 0.35rem;
    width: 100%;
    padding: 0.9rem 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--schedule-type-color, var(--accent-blue));
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.schedule-event-card:hover,
.schedule-event-card:focus-visible {
    border-color: var(--schedule-type-color, var(--accent-blue));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.schedule-event-time { color: var(--text-secondary); font-size: 0.76rem; }
.schedule-event-title { font-size: 1rem; font-weight: 800; }
.schedule-event-meta { color: var(--text-secondary); font-size: 0.8rem; }

.schedule-type-service { --schedule-type-color: #f59e0b; }
.schedule-type-installation { --schedule-type-color: #3b82f6; }
.schedule-type-calibration { --schedule-type-color: #8b5cf6; }
.schedule-type-training { --schedule-type-color: #10b981; }
.schedule-type-internal { --schedule-type-color: #64748b; }
.schedule-type-travel { --schedule-type-color: #06b6d4; }
.schedule-type-leave { --schedule-type-color: #f43f5e; }

.schedule-people-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.schedule-people-chips span,
.schedule-unassigned,
.schedule-sync {
    width: fit-content;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.schedule-people-chips span { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
.schedule-unassigned { background: rgba(245, 158, 11, 0.15); color: #a16207; }
.schedule-sync { color: var(--text-secondary); background: rgba(100, 116, 139, 0.12); }
.schedule-sync-synced { color: #047857; background: rgba(16, 185, 129, 0.12); }
.schedule-sync-error { color: #be123c; background: rgba(244, 63, 94, 0.12); }
.schedule-sync-cancelled { color: #475569; }

.schedule-availability { min-width: 920px; overflow-x: auto; }
.schedule-availability-head,
.schedule-availability-row {
    display: grid;
    grid-template-columns: 180px repeat(var(--schedule-days), minmax(115px, 1fr));
}

.schedule-availability-head > div,
.schedule-availability-row > div {
    min-height: 64px;
    padding: 0.55rem;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.schedule-availability-head > div {
    min-height: auto;
    background: #111;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
}

.schedule-staff-cell { display: grid; align-content: center; background: var(--bg-card); }
.schedule-staff-cell small { color: var(--text-secondary); }
.schedule-availability-cell.free { color: #047857; background: rgba(16, 185, 129, 0.05); }
.schedule-availability-cell.busy { display: grid; gap: 0.25rem; background: rgba(244, 63, 94, 0.04); }

.schedule-mini-event,
.schedule-month-event {
    display: block;
    width: 100%;
    padding: 0.3rem 0.4rem;
    overflow: hidden;
    border: 0;
    border-left: 3px solid var(--schedule-type-color, var(--accent-blue));
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.72rem;
}

.schedule-month-weekdays,
.schedule-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.schedule-month-weekdays span { padding: 0.5rem; background: #111; color: #fff; text-align: center; font-size: 0.75rem; font-weight: 800; }
.schedule-month-day { display: grid; align-content: start; gap: 0.3rem; min-height: 125px; padding: 0.5rem; border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); background: var(--bg-card); }
.schedule-month-day.outside { opacity: 0.5; background: var(--bg-main); }

.schedule-external { margin-top: 1rem; padding: 0.8rem 1rem; border: 1px dashed var(--border-color); border-radius: 10px; }
.schedule-external summary { cursor: pointer; font-weight: 700; }
.schedule-external .schedule-event-list { margin-top: 0.8rem; }
.schedule-external-card { display: grid; gap: 0.35rem; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-card); }
.schedule-import-button { width: fit-content; margin-top: 0.35rem; }
.schedule-import-notice { display: flex; gap: 0.65rem; padding: 0.75rem; border: 1px solid rgba(59, 130, 246, 0.35); border-radius: 8px; background: rgba(59, 130, 246, 0.08); }
.schedule-import-notice i { margin-top: 0.15rem; color: var(--accent-blue); }
.schedule-import-notice div { display: grid; gap: 0.2rem; }
.schedule-import-notice span { color: var(--text-secondary); font-size: 0.84rem; }

.schedule-event-form { display: grid; gap: 1rem; }
.schedule-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.schedule-span-2 { grid-column: 1 / -1; }
.schedule-check { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.schedule-check input { width: 18px; height: 18px; accent-color: var(--accent-cyan); }
.schedule-private-field { outline: 2px solid rgba(139, 92, 246, 0.14); outline-offset: 4px; }

.schedule-assignment-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.schedule-assignment-grid > section {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
}

.schedule-assignment-grid h4,
.schedule-assignment-grid p { margin: 0 0 0.4rem; }
.schedule-assignment-grid p { color: var(--text-secondary); font-size: 0.78rem; }

.schedule-person-picker { display: grid; gap: 0.35rem; max-height: 220px; overflow-y: auto; }
.schedule-person-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem; border-radius: 7px; cursor: pointer; }
.schedule-person-option:hover { background: var(--bg-card-hover); }
.schedule-person-option input { width: 17px; height: 17px; accent-color: var(--accent-cyan); }
.schedule-person-option span { display: grid; }
.schedule-person-option small { color: var(--text-secondary); }

.schedule-conflict-result { display: none; gap: 0.35rem; padding: 0.75rem; border-radius: 8px; }
.schedule-conflict-result.clear,
.schedule-conflict-result.warning,
.schedule-conflict-result.conflict { display: grid; }
.schedule-conflict-result.clear { color: #047857; background: rgba(16, 185, 129, 0.1); }
.schedule-conflict-result.warning { color: #a16207; background: rgba(245, 158, 11, 0.12); }
.schedule-conflict-result.conflict { color: #be123c; background: rgba(244, 63, 94, 0.1); }

.schedule-event-detail { display: grid; gap: 1rem; }
.schedule-detail-summary { padding: 1rem; border-left: 5px solid var(--schedule-type-color, var(--accent-blue)); border-radius: 10px; background: var(--bg-card); }
.schedule-detail-summary h3 { margin: 0.7rem 0; }
.schedule-detail-summary p { margin: 0.35rem 0; }
.schedule-description { white-space: pre-wrap; }
.schedule-detail-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.schedule-detail-people section { display: grid; gap: 0.25rem; padding: 0.7rem; border: 1px solid var(--border-color); border-radius: 8px; }
.schedule-detail-people span { color: var(--text-secondary); }
.schedule-response-form,
.schedule-audit { padding: 0.85rem; border: 1px solid var(--border-color); border-radius: 10px; }
.schedule-audit-row { display: grid; grid-template-columns: 145px 1fr auto; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border-color); }
.schedule-audit-row time { color: var(--text-secondary); font-size: 0.75rem; }
.schedule-iphone-help { line-height: 1.65; }

@media (max-width: 920px) {
    .schedule-heading,
    .schedule-toolbar { align-items: stretch; flex-direction: column; }
    .schedule-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .schedule-assignment-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .schedule-filters,
    .schedule-form-grid,
    .schedule-detail-people { grid-template-columns: 1fr; }
    .schedule-span-2 { grid-column: auto; }
    .schedule-view-tabs button { flex: 1 1 45%; }
    .schedule-range-controls { justify-content: space-between; }
    .schedule-range-controls strong { min-width: 0; }
    .schedule-month-day { min-height: 88px; padding: 0.3rem; }
    .schedule-month-event { font-size: 0; min-height: 8px; padding: 0; }
    .schedule-audit-row { grid-template-columns: 1fr; }
}

.security-status-card {
    display: grid;
    gap: 0.45rem;
    padding: 1.2rem;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-emerald);
    border-radius: 12px;
    background: var(--bg-card);
}

.security-status-card > span,
.security-status-card p {
    color: var(--text-secondary);
}

.security-status-card > strong {
    font-size: 1.6rem;
    text-transform: uppercase;
}

.security-status-card.mode-customersOff,
.security-status-card.mode-readOnly {
    border-left-color: #f59e0b;
}

.security-status-card.mode-fullLockdown {
    border-left-color: var(--accent-rose);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.14) !important;
    border-color: var(--accent-rose) !important;
    color: var(--accent-rose) !important;
}

@media (max-width: 980px) {
    .manager-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .manager-kpi-grid {
        grid-template-columns: 1fr;
    }

    .manager-task-card,
    .manager-calendar-card {
        grid-template-columns: 1fr;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    zoom: 90%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* Header & Logo styling */
header {
    background: rgba(30, 41, 59, 0.9); /* Dark Navy */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.65rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: 0.02em;
}

.logo-dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.user-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.user-badge .role {
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
}

.role.admin { background: var(--accent-rose-glow); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.role.technician { background: var(--accent-amber-glow); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.role.customer { background: var(--accent-blue-glow); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.3); }

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.825rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

/* Sidebar toggle button - make white */
#sidebar-toggle-btn {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
#sidebar-toggle-btn:hover {
    background: var(--bg-card-hover);
}


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

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Portal startup, sign-in and non-disruptive data loading */
.portal-startup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--text-primary);
    background:
        radial-gradient(circle at top right, rgba(212, 175, 55, 0.13), transparent 36%),
        var(--bg-main);
    opacity: 1;
    visibility: visible;
    transition: opacity .22s ease, visibility .22s ease;
}

.portal-startup.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.portal-startup-card {
    width: min(100%, 420px);
    padding: 34px 30px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 22px 55px rgba(0, 0, 0, .28);
}

.portal-startup-card img {
    display: block;
    width: min(100%, 260px);
    height: 48px;
    margin: 0 auto 24px;
    object-fit: contain;
}

.portal-startup-card h1 {
    margin: 18px 0 7px;
    font-size: 1.4rem;
}

.portal-startup-card p,
.signin-status {
    color: var(--text-secondary);
}

.portal-startup-spinner,
.portal-inline-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(14, 165, 233, .2);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: portal-spin .75s linear infinite;
}

.portal-inline-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
    flex: 0 0 auto;
}

@keyframes portal-spin { to { transform: rotate(360deg); } }

.signin-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    margin: 12px 0 0;
    font-size: .84rem;
}

.portal-progress {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: .84rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.portal-progress.is-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.panel-refreshing {
    cursor: progress;
}

form[aria-busy="true"] button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: wait;
}

@media (max-width: 680px) {
    .portal-progress { top: 70px; right: 16px; }
    .portal-startup-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .portal-startup,
    .portal-progress { transition: none; }
    .portal-startup-spinner,
    .portal-inline-spinner { animation-duration: 1.5s; }
}

/* Authentication Screen */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 160px);
    padding: 1.5rem;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2), 0 20px 48px rgba(0, 0, 0, 0.3);
    position: relative;
    backdrop-filter: blur(10px);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 20px 20px 0 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-tabs {
    display: flex;
    background: var(--bg-main);
    padding: 0.35rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition-smooth);
    font-size: 0.95rem;
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--accent-cyan);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1.2rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-glow);
    box-shadow: 0 0 0 3px var(--accent-cyan-glow);
    background: var(--bg-card);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--accent-cyan);
    color: #0f172a;
    border: none;
    border-radius: 10px;
    padding: 0.95rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px var(--accent-cyan-glow);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn:hover {
    background: #0891b2;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
    box-shadow: none;
}

.btn-danger {
    background: transparent;
    border: 1.5px solid var(--accent-rose);
    color: var(--accent-rose);
    box-shadow: none;
}

.btn-danger:hover {
    background: var(--accent-rose);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-rose-glow);
}

.btn-small {
    padding: 0.5rem 1.25rem;
    font-size: 0.825rem;
    width: auto;
    border-radius: 8px;
}

.btn-micro {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    width: auto;
    border-radius: 6px;
    font-weight: 700;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.825rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

/* Compact, modern authentication surfaces shared by staff and customers */
.auth-wrapper {
    min-height: calc(100vh - 112px);
    padding: clamp(1rem, 3vh, 2rem);
}

.auth-wrapper .glass-card {
    max-width: 460px;
    padding: 2rem 2.1rem 1.65rem;
    border-color: #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
    backdrop-filter: none;
}

.auth-wrapper .glass-card::before {
    height: 2px;
    border-radius: 16px 16px 0 0;
}

.auth-wrapper .auth-header {
    margin-bottom: 1.4rem;
}

.auth-wrapper .auth-header h1,
.auth-wrapper .auth-header h2 {
    margin-bottom: 0.4rem;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.auth-wrapper .auth-header p {
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.5;
}

.auth-wrapper .auth-tabs {
    margin-bottom: 1.3rem;
    padding: 0.25rem;
    border-radius: 10px;
}

.auth-wrapper .auth-tab {
    padding: 0.62rem;
    border-radius: 7px;
    font-size: 0.84rem;
    font-weight: 500;
}

.auth-wrapper .form-group {
    margin-bottom: 1rem;
}

.auth-wrapper .form-group label {
    margin-bottom: 0.42rem;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    text-transform: none;
}

.auth-wrapper .form-control {
    min-height: 44px;
    padding: 0.7rem 0.9rem;
    border-color: #dbe1e8;
    border-radius: 9px;
    font-size: 0.88rem;
}

.auth-wrapper .btn {
    min-height: 44px;
    padding: 0.72rem 1rem;
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 5px 14px rgba(212, 175, 55, 0.18);
}

.auth-wrapper .security-trust-device {
    margin: 0.15rem 0 0.9rem;
    font-size: 0.78rem;
}

.auth-wrapper .security-trust-device input {
    width: 16px;
    height: 16px;
}

.auth-wrapper .auth-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    font-size: 0.76rem;
    line-height: 1.5;
}

/* Dashboard Workspace Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    z-index: 1001;
    border-radius: 0 16px 16px 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.25rem;
    overflow-y: auto;
}

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

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 1.5rem 1rem 0.75rem 1rem;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition-smooth);
    cursor: pointer;
    font-size: 0.925rem;
    width: 100%;
    border: 0;
    background: transparent;
    font-family: inherit;
    text-align: left;
}

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

.sidebar-link.active {
    color: var(--accent-cyan);
    background: var(--accent-cyan-glow);
    border-left: 4px solid var(--accent-cyan);
}

.sidebar-panel {
    margin-top: auto;
    padding: 1.25rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.sidebar-panel h4 {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.825rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.stat-val {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent-cyan);
}

.main-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2.5rem;
    min-height: 700px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.content-header h2 {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Machinery Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

/* Premium Tech Card Design */
.machine-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.machine-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 24px rgba(6, 182, 212, 0.15);
}

.machine-media {
    height: 120px;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.machine-media img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.machine-icon-placeholder {
    font-size: 2.5rem;
}

.machine-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.machine-details {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.machine-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.machine-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.machine-meta span {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.25rem;
}

.machine-meta span strong {
    color: var(--text-primary);
}

.warranty-pill {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.warranty-pill.active {
    background: var(--accent-emerald-glow);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.warranty-pill.expired {
    background: var(--accent-rose-glow);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Premium Industrial Tables */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-secondary);
    padding: 1.1rem 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Modal Overlay Styling */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.modal-large {
    max-width: 950px;
}

.overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-close {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    background: var(--accent-rose-glow);
    color: var(--accent-rose);
    border-color: var(--accent-rose);
}

/* Badges styling */
.badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.725rem;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-pending { background: var(--accent-amber-glow); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-approved { background: var(--accent-emerald-glow); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-draft { background: var(--bg-main); color: var(--text-secondary); border: 1px solid var(--border-color); }
.badge-published { background: var(--accent-blue-glow); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.3); }

/* Toast styling */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 6px solid var(--accent-cyan);
    border-radius: 12px;
    padding: 1.25rem 2rem;
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    transform: translateY(120px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.active {
    transform: translateY(0);
    opacity: 1;
}

/* KPI Banner & Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.kpi-card.blue::after { background: var(--accent-blue); }
.kpi-card.cyan::after { background: var(--accent-cyan); }
.kpi-card.amber::after { background: var(--accent-amber); }
.kpi-card.violet::after { background: var(--accent-violet); }

.kpi-title {
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.customer-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.customer-card:hover {
    border-color: var(--accent-cyan);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.customer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
}

.admin-sec-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Split Pane review styling */
.split-pane {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.split-left, .split-right {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.review-box {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    min-height: 380px;
}

.list-item-clickable {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.list-item-clickable:hover, .list-item-clickable.active {
    background: var(--bg-card-hover);
    border-color: var(--accent-cyan);
}

/* Utility rules */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-column { flex-direction: column; }
.w-full { width: 100%; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.d-none { display: none !important; }
code { font-family: 'Outfit', monospace; font-size: 0.875rem; color: var(--accent-cyan); }

/* Premium Icon Buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0;
}
.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}
.btn-icon.btn-icon-danger:hover {
    background: var(--accent-rose-glow);
    color: var(--accent-rose);
    border-color: var(--accent-rose);
}
.btn-icon.btn-icon-success:hover {
    background: var(--accent-emerald-glow);
    color: var(--accent-emerald);
    border-color: var(--accent-emerald);
}

/* Customer Portal Specific Card Layouts */
.customer-portal .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.5rem;
}
.customer-portal .machine-card {
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.customer-portal .machine-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(6,182,212,0.2);
}
.customer-portal .machine-media {
    height: 120px;
}
.customer-portal .machine-icon-placeholder {
    font-size: 2.5rem;
}
.customer-portal .machine-tag {
    top: 10px;
    right: 10px;
    font-size: 0.65rem;
    padding: 0.25rem 0.6rem;
}
.customer-portal .machine-details {
    padding: 1.25rem;
}
.customer-portal .machine-title h3 {
    font-size: 1.15rem;
    margin-bottom: 0.65rem;
}
.customer-portal .machine-meta {
    font-size: 0.825rem;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
}
.customer-portal .machine-meta span {
    padding-bottom: 0.25rem;
}

/* Material Shop Interface Styling */
.material-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.material-item-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: var(--transition-smooth);
}

.material-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
}

.material-image-container {
    height: 180px;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.material-item-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 10px;
}

.material-item-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.material-item-details h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-qty {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0 !important;
}

.qty-input {
    text-align: center;
    font-weight: 700;
    width: 50px !important;
    height: 32px !important;
    padding: 0 !important;
    background: var(--bg-main) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 6px;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mt-3 {
    margin-top: 1.5rem;
}

.offcanvas-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.offcanvas-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Customer portal: follows the staff portal component system */
.customer-portal {
    /* Inherit the same scale as the staff portal. */
}

.customer-portal .portal-header {
    min-height: 72px;
    background: rgba(30, 41, 59, 0.96);
    border-bottom-color: rgba(212, 175, 55, 0.32);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.18);
}

.staff-portal .portal-header {
    min-height: 72px;
    background: rgba(30, 41, 59, 0.96);
    border-bottom-color: rgba(212, 175, 55, 0.32);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.18);
}

.header-brand-group,
.customer-brand,
.staff-brand,
.sidebar-header-row,
.header-action {
    display: flex;
    align-items: center;
}

.header-brand-group {
    gap: 12px;
    min-width: 0;
}

.customer-brand {
    gap: 14px;
    color: #ffffff;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.staff-brand {
    gap: 14px;
    color: #ffffff;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.customer-brand img {
    width: 156px;
    height: 28px;
    object-fit: contain;
}

.staff-brand img {
    width: 156px;
    height: 28px;
    object-fit: contain;
}

.customer-brand span {
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.92rem;
}

.staff-brand span {
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.92rem;
}

.header-icon-button,
.sidebar-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.header-icon-button {
    width: 38px;
    height: 38px;
    border-radius: 8px;
}

.header-icon-button:hover,
.sidebar-close-button:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: var(--accent-cyan-glow);
}

.customer-portal .user-badge {
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.36);
    gap: 0.75rem;
}

.staff-portal .user-badge {
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.36);
    gap: 0.75rem;
}

.customer-portal .header-action {
    gap: 7px;
    color: #e5e7eb;
    white-space: nowrap;
}

.staff-portal .header-action {
    gap: 7px;
    color: #e5e7eb;
    white-space: nowrap;
}

.customer-portal .header-action:hover {
    color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.06);
}

.staff-portal .header-action:hover {
    color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.06);
}

.staff-auth-card {
    max-width: 460px;
}

.customer-auth-card {
    max-width: 460px;
}

.customer-auth-card.registration-active {
    max-width: 680px;
}

.auth-brand-mark {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
    padding: 0;
    background: transparent;
}

.auth-brand-mark img {
    width: min(100%, 176px);
    height: 32px;
    object-fit: contain;
}

.customer-auth-card .auth-header h1 {
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.4rem;
}

.customer-auth-card .auth-header p {
    color: var(--text-secondary);
}

.registration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
}

.registration-full {
    grid-column: 1 / -1;
}

.customer-portal textarea.form-control {
    resize: vertical;
    min-height: 76px;
    font-family: var(--font-sans);
}

.customer-portal .sidebar {
    padding-top: 1.25rem;
}

.sidebar-header-row {
    justify-content: space-between;
    gap: 12px;
    margin: 0 0.25rem 0.75rem;
}

.sidebar-header-row .sidebar-heading {
    margin: 0;
}

.sidebar-close-button {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    color: var(--text-secondary);
    border-color: var(--border-color);
    background: var(--bg-main);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    cursor: pointer;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.customer-portal.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

.status-online {
    color: var(--accent-emerald) !important;
}

.customer-portal .sidebar-link i {
    width: 20px;
    text-align: center;
}

.customer-portal .content-header h2,
.customer-portal .admin-sec-title {
    gap: 0.65rem;
}

.customer-portal .content-header h2 i,
.customer-portal .admin-sec-title i {
    color: var(--accent-cyan);
}

.customer-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.customer-summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.customer-summary-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    color: var(--accent-cyan);
    background: var(--accent-cyan-glow);
    border-radius: 10px;
}

.customer-summary-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.customer-summary-value {
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
}

.section-intro {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin: -0.75rem 0 1.5rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.section-intro i {
    color: var(--accent-blue);
    margin-top: 0.25rem;
}

.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--bg-main);
    border: 1px dashed var(--border-color);
    border-radius: 14px;
}

.empty-state i {
    display: block;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 2rem;
}

.empty-state h3 {
    margin-bottom: 0.4rem;
}

.empty-state p {
    color: var(--text-secondary);
}

.machine-media .machine-fallback-icon {
    position: absolute;
    color: var(--text-muted);
    font-size: 2.6rem;
}

.machine-media img {
    position: relative;
    z-index: 1;
}

.machine-card-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
    color: var(--accent-cyan);
    font-size: 0.8rem;
    font-weight: 700;
}

.material-item-card.glass-card {
    max-width: none;
    padding: 0;
}

.customer-portal .material-image-container {
    height: 230px;
    background: #f8fafc;
}

.customer-portal .material-item-image {
    max-width: 86%;
    max-height: 94%;
    padding: 14px;
}

.product-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.product-price {
    color: var(--accent-cyan);
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
}

.product-unit {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.order-submit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.15rem 1.25rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.order-submit-bar .btn {
    width: auto;
}

.order-total-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.order-total-value {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 800;
}

.table-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.table-action-group .btn-icon {
    flex: 0 0 auto;
}

.customer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--text-secondary);
    gap: 0.75rem;
}

.customer-loading i {
    color: var(--accent-cyan);
}

@media (max-width: 900px) {
    .customer-summary-grid {
        grid-template-columns: 1fr;
    }

    .customer-portal .container {
        padding: 1rem;
    }

    .customer-portal .main-content {
        min-height: 560px;
        padding: 1.5rem;
    }

    .customer-portal .portal-header {
        padding: 0.75rem 1rem;
    }

    .staff-portal .portal-header {
        padding: 0.75rem 1rem;
    }

    .customer-portal #user-email-display,
    .customer-portal #user-role-badge,
    .staff-portal #user-email-display,
    .staff-portal #user-role-badge {
        display: none;
    }
}

@media (max-width: 640px) {
    .customer-brand img {
        width: 128px;
        height: 24px;
    }

    .staff-brand img {
        width: 128px;
        height: 24px;
    }

    .customer-brand span,
    .staff-brand span,
    .header-action span {
        display: none;
    }

    .customer-portal .user-badge {
        padding: 0.35rem;
        gap: 0.25rem;
    }

    .staff-portal .user-badge {
        padding: 0.35rem;
        gap: 0.25rem;
    }

    .customer-portal .header-action {
        width: 36px;
        height: 36px;
        justify-content: center;
        padding: 0;
    }

    .staff-portal .header-action {
        width: 36px;
        height: 36px;
        justify-content: center;
        padding: 0;
    }

    .customer-auth-card {
        padding: 1.5rem 1.25rem 1.3rem;
    }

    .registration-grid {
        grid-template-columns: 1fr;
    }

    .registration-full {
        grid-column: auto;
    }

    .customer-portal .content-header {
        align-items: flex-start;
    }

    .customer-portal .content-header h2 {
        font-size: 1.4rem;
    }

    .material-shop-grid {
        grid-template-columns: 1fr;
    }

    .order-submit-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .order-submit-bar .btn {
        width: 100%;
    }
}

/* Release K: assignment-based machine workflow */
.workflow-help { color: var(--text-muted); font-size: .82rem; line-height: 1.5; margin: .4rem 0 1rem; }
.workflow-danger { color: var(--accent-rose) !important; }
.workflow-good { color: var(--accent-emerald) !important; }
.workflow-loading { color: var(--text-secondary); padding: 1.5rem 0; }
.workflow-section-title { color: var(--accent-cyan); margin: 1.2rem 0 .8rem; }
.workflow-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workflow-header { align-items: flex-start; gap: 1rem; }
.workflow-header h2 { margin: 1rem 0 .25rem; }
.workflow-header p { color: var(--text-secondary); }
.workflow-header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.workflow-header-actions .btn { width: auto; }
.workflow-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0 2rem; }
.workflow-summary-grid article { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: 10px; background: rgba(255,255,255,.02); }
.workflow-summary-grid span { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.workflow-summary-grid small { color: var(--text-secondary); }
.workflow-tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 2rem; }
.workflow-tools-grid section { border: 1px solid var(--border-color); border-radius: 12px; padding: 1rem; background: rgba(255,255,255,.015); }
.workflow-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.workflow-section-heading h3 { margin: 0; }
.workflow-list-item { border-top: 1px solid var(--border-color); padding: .8rem 0; display: flex; flex-direction: column; gap: .3rem; }
.workflow-list-item span, .workflow-list-item small { color: var(--text-muted); font-size: .78rem; }
.workflow-list-item p { color: var(--text-secondary); white-space: pre-wrap; }
.workflow-entry-list { display: grid; }
.workflow-scroll-region {
    max-height: 22rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: .4rem;
}
.workflow-report-scroll { max-height: 21rem; padding-right: 0; }
.workflow-report-scroll th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ececec;
}
.workflow-note-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}
.workflow-note-actions {
    display: flex;
    flex: 0 0 auto;
    gap: .35rem;
}
.workflow-note-actions .btn {
    width: auto;
    padding: .35rem .55rem;
}
.workflow-link { background: none; border: 0; color: var(--accent-cyan); font-weight: 700; cursor: pointer; text-decoration: underline; }
.workflow-machine-actions { display: grid; gap: .65rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.workflow-coverage-card { display: flex; flex-direction: column; gap: .25rem; margin-top: .4rem; padding: .7rem; border-radius: 8px; border: 1px solid var(--border-color); }
.workflow-coverage-card.active { border-color: var(--accent-emerald); background: rgba(16,185,129,.06); }
.workflow-coverage-card.expired { border-color: var(--accent-rose); background: rgba(244,63,94,.06); color: var(--accent-rose); }
.workflow-coverage-card span { color: var(--text-secondary); font-size: .78rem; }
.workflow-material-store { margin: 1.5rem 0 2rem; padding: 1.25rem; border: 1px solid var(--border-color); border-radius: 12px; background: rgba(255,255,255,.015); }
.workflow-toggle { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.workflow-toggle input { accent-color: var(--accent-cyan); }
.workflow-price-field { display: flex; align-items: center; gap: .5rem; min-width: 150px; }
.workflow-price-field .form-control { min-width: 90px; }
@media (max-width: 760px) {
  .workflow-two, .workflow-summary-grid, .workflow-tools-grid { grid-template-columns: 1fr; }
  .workflow-header-actions { justify-content: flex-start; }
}
