/* ===== CSS Variables ===== */
:root {
    --color-primary: #1a365d;
    --color-secondary: #2b6cb0;
    --color-accent: #ed8936;
    --color-bg: #f7fafc;
    --color-card: #ffffff;
    --color-text: #2d3748;
    --color-text-light: #718096;
    --color-border: #e2e8f0;
    --color-empty: #edf2f7;
    --color-hover: #ebf4ff;
    --color-today: #fefcbf;
    --color-weekend: #f0f5ff;
    --color-error: #e53e3e;
    --color-error-bg: #fed7d7;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== App Shell ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, min-width 0.2s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 101;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 56px;
    min-width: 56px;
}

.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 49px;
}

.sidebar-logo {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sidebar-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sidebar-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sidebar-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
    border-left: 3px solid var(--color-accent);
}

.sidebar-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-toggle {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    text-align: left;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: color 0.15s;
}

.sidebar-toggle:hover {
    color: #fff;
}

.sidebar-backdrop {
    display: none;
}

/* Mobile menu button (hidden on desktop) */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
}

/* Page container for non-schedule pages */
.page-container {
    padding: 20px 24px;
    flex: 1;
}

.page-container.hidden {
    display: none !important;
}

/* ===== Header ===== */
.app-header {
    background: var(--color-primary);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

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

/* ===== Page Title Bar ===== */
.page-title-bar {
    background: var(--color-card);
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--color-border);
}

.page-title-bar h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.upload-btn {
    background: var(--color-accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #dd6b20;
}

/* ===== Toolbar ===== */
.toolbar {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 49px;
    z-index: 99;
}

.view-switcher {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-switcher button {
    background: var(--color-card);
    border: none;
    padding: 6px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--color-text);
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--color-border);
}

.view-switcher button:last-child {
    border-right: none;
}

.view-switcher button:hover {
    background: var(--color-hover);
}

.view-switcher button.active {
    background: var(--color-secondary);
    color: #fff;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navigation button {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--color-text);
    transition: background 0.15s;
}

.navigation button:hover {
    background: var(--color-hover);
}

#date-label {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 200px;
    text-align: center;
}

.filter-controls select {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--color-text);
    background: var(--color-card);
    cursor: pointer;
}

/* ===== Error Banner ===== */
.error-banner {
    background: var(--color-error-bg);
    color: var(--color-error);
    padding: 10px 24px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-error);
}

.error-banner.hidden {
    display: none;
}

/* ===== Main Container ===== */
#schedule-container {
    padding: 20px 24px;
    transition: opacity 0.15s ease-in-out;
}

#schedule-container.fading {
    opacity: 0;
}

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

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.template-info {
    margin-top: 16px;
    padding: 12px 20px;
    background: var(--color-empty);
    border-radius: var(--radius);
    display: inline-block;
    font-size: 0.8rem;
}

/* ===== Daily View ===== */
.daily-view {
    width: 100%;
}

.daily-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.daily-table th,
.daily-table td {
    border: 1px solid var(--color-border);
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
}

.daily-table thead th {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.daily-table .session-label {
    background: var(--color-empty);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    width: 130px;
    min-width: 130px;
}

.daily-table .session-label .session-num {
    display: block;
    color: var(--color-primary);
    font-size: 0.85rem;
}

.daily-table .session-label .session-time {
    display: block;
    color: var(--color-text-light);
    font-size: 0.75rem;
    font-weight: 400;
}

.session-cell {
    min-height: 60px;
    cursor: pointer;
    transition: background 0.15s;
}

.session-cell:hover {
    background: var(--color-hover);
}

.session-cell.empty {
    color: var(--color-text-light);
    font-size: 0.8rem;
    cursor: default;
}

.session-cell.empty:hover {
    background: transparent;
}

.session-entry {
    padding: 4px 0;
}

.session-entry .trainee {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}

.session-entry .course {
    font-size: 0.8rem;
    color: var(--color-secondary);
}

.session-entry .instructor {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.session-entry .observer {
    font-size: 0.75rem;
    color: var(--color-text-light);
    font-style: italic;
}

.session-entry .remarks-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
    title: "Has remarks";
}

/* ===== Weekly View ===== */
.weekly-view {
    width: 100%;
}

.weekly-grid {
    display: grid;
    grid-template-columns: 130px repeat(7, 1fr);
    gap: 0;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}

.weekly-header {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    background: var(--color-primary);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.weekly-header.corner {
    background: var(--color-primary);
}

.weekly-header.today {
    background: var(--color-accent);
}

.weekly-header .day-name {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
}

.weekly-header .day-num {
    display: block;
    font-size: 1.1rem;
    margin-top: 2px;
}

.weekly-session-label {
    padding: 8px 10px;
    background: var(--color-empty);
    font-weight: 600;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weekly-session-label .s-num {
    color: var(--color-primary);
    font-size: 0.8rem;
}

.weekly-session-label .s-time {
    color: var(--color-text-light);
    font-size: 0.65rem;
    font-weight: 400;
}

.weekly-cell {
    padding: 4px 6px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    min-height: 56px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: background 0.15s;
}

.weekly-cell:hover {
    background: var(--color-hover);
}

.weekly-cell.weekend {
    background: var(--color-weekend);
}

.weekly-cell.weekend:hover {
    background: var(--color-hover);
}

.weekly-cell.today-col {
    background: var(--color-today);
}

.weekly-card {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    color: #fff;
    line-height: 1.3;
    transition: opacity 0.15s;
}

.weekly-card:hover {
    opacity: 0.85;
}

.weekly-card .wc-trainee {
    font-weight: 600;
    display: block;
}

.weekly-card .wc-fstd {
    font-size: 0.6rem;
    opacity: 0.85;
    display: block;
}

.weekly-cell-empty {
    color: var(--color-text-light);
    font-size: 0.65rem;
    text-align: center;
    padding-top: 16px;
}

/* ===== Monthly View ===== */
.monthly-view {
    width: 100%;
}

.monthly-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--color-border);
}

.monthly-header {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    background: var(--color-primary);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.monthly-cell {
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    min-height: 80px;
    cursor: pointer;
    transition: background 0.15s;
}

.monthly-cell:hover {
    background: var(--color-hover);
}

.monthly-cell.outside {
    background: var(--color-empty);
    opacity: 0.5;
    cursor: default;
}

.monthly-cell.outside:hover {
    background: var(--color-empty);
}

.monthly-cell.today {
    background: var(--color-today);
}

.monthly-cell.weekend {
    background: var(--color-weekend);
}

.monthly-date-num {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--color-text);
}

.monthly-cell.today .monthly-date-num {
    background: var(--color-accent);
    color: #fff;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.monthly-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.monthly-bar {
    height: 6px;
    border-radius: 3px;
    display: flex;
    gap: 2px;
}

.monthly-bar-segment {
    height: 100%;
    border-radius: 3px;
    flex: 1;
}

.monthly-bar.empty {
    background: var(--color-border);
    opacity: 0.4;
}

.monthly-count {
    font-size: 0.65rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ===== No Data State (within views) ===== */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* ===== Modal (detail-modal wider for FLOG) ===== */
#detail-modal .modal-content {
    width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: relative;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-width: 90vw;
    z-index: 1;
}

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

.modal-header h3 {
    font-size: 1rem;
    color: var(--color-primary);
}

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

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

#modal-body {
    padding: 20px;
}

.modal-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-empty);
}

.modal-row:last-child {
    border-bottom: none;
}

.modal-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    width: 100px;
    min-width: 100px;
    font-weight: 500;
}

.modal-value {
    font-size: 0.85rem;
    color: var(--color-text);
    font-weight: 500;
}

.modal-fstd-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ===== Auth Screen ===== */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, #2c5282 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.auth-container {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 420px;
    max-width: 90vw;
    text-align: center;
}

.auth-logo {
    font-size: 3rem;
    margin-bottom: 8px;
}

.auth-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.auth-error {
    background: var(--color-error-bg);
    color: var(--color-error);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    margin-bottom: 16px;
    text-align: left;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--color-text);
    transition: border-color 0.15s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.auth-btn {
    background: var(--color-secondary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

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

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-empty);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

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

.auth-switch {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 4px;
}

.auth-switch a {
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.org-toggle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    padding: 8px 0;
}

.org-toggle label {
    font-size: 0.8rem;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.org-toggle input[type="radio"] {
    accent-color: var(--color-secondary);
}

/* ===== User Info (Header) ===== */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-name {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

/* .org-badge removed — org name now displays centred in header as .org-name-header */

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

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

/* ===== Upload Modal ===== */
.upload-modal-body {
    padding: 20px;
}

.upload-modal-body > p {
    font-size: 0.85rem;
    color: var(--color-text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.upload-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.upload-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text);
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: background 0.15s;
}

.upload-option:hover {
    background: var(--color-hover);
}

.upload-option input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--color-secondary);
}

.upload-actions {
    display: flex;
    gap: 10px;
}

.upload-actions .auth-btn,
.upload-actions .btn-secondary {
    flex: 1;
}

.upload-progress {
    margin-top: 16px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-empty);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 100%;
    background: var(--color-secondary);
    border-radius: 3px;
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

#upload-status {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(247, 250, 252, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    gap: 16px;
}

.loading-overlay p {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
/* ===== FLOG Form Styles ===== */
.flog-details {
    border-bottom: none;
}

.flog-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.flog-divider::before,
.flog-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--color-primary);
    opacity: 0.2;
}

.flog-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flog-form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.flog-form-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    width: 100px;
    min-width: 100px;
    font-weight: 500;
}

.flog-form-input {
    flex: 1;
}

.flog-form-input input[type="date"],
.flog-form-input input[type="time"],
.flog-form-input input[type="number"] {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-card);
    transition: border-color 0.15s;
}

.flog-form-input input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.flog-form-input input[type="number"] {
    width: 80px;
}

.flog-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.flog-unit {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Rating radio buttons */
.flog-rating {
    display: flex;
    gap: 6px;
}

.flog-rating-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flog-rating-option input[type="radio"] {
    display: none;
}

.flog-rating-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-light);
    transition: all 0.15s;
}

.flog-rating-option input[type="radio"]:checked + .flog-rating-label {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}

.flog-rating-option:hover .flog-rating-label {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.flog-rating-option input[type="radio"]:checked + .flog-rating-label:hover {
    color: #fff;
}

/* Action buttons */
.flog-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.flog-save-btn {
    background: var(--color-secondary);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.flog-save-btn:hover {
    background: var(--color-primary);
}

.flog-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flog-print-btn {
    background: var(--color-empty);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.flog-print-btn:hover {
    background: var(--color-border);
}

/* Status messages */
.flog-status {
    font-size: 0.8rem;
    margin-left: auto;
}

.flog-status.saved {
    color: #38a169;
    font-weight: 500;
}

.flog-status.error {
    color: var(--color-error);
    font-weight: 500;
}

.flog-status.loading {
    color: var(--color-text-light);
}

.flog-status.completed {
    color: #38a169;
    font-weight: 600;
}

/* Locked FLOG form (completed state) */
.flog-form.flog-locked {
    opacity: 0.6;
    pointer-events: none;
}

.flog-form.flog-locked input {
    background: var(--color-empty) !important;
    color: var(--color-text-light) !important;
    cursor: not-allowed;
}

.flog-form.flog-locked .flog-rating-label {
    cursor: not-allowed;
}

/* Reopen button (admin only) */
.flog-reopen-btn {
    background: var(--color-accent);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.flog-reopen-btn:hover {
    background: #dd6b20;
}

.flog-reopen-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Raise Defect Button ===== */
.flog-defect-btn {
    background: #c53030;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.flog-defect-btn:hover {
    background: #9b2c2c;
}

/* ===== Defect Section ===== */
.defect-section {
    margin-top: 16px;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

/* ── Defect Inline Form ── */
.defect-form {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

.defect-form-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #c53030;
}

.defect-form-row {
    margin-bottom: 10px;
}

.defect-form-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.defect-form-row textarea,
.defect-form-row select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    resize: vertical;
}

.defect-form-row textarea:focus,
.defect-form-row select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

.defect-input-error {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2) !important;
}

.defect-form-actions {
    display: flex;
    gap: 8px;
}

.defect-submit-btn {
    background: #c53030;
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.defect-submit-btn:hover {
    background: #9b2c2c;
}

.defect-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.defect-cancel-btn {
    background: transparent;
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    padding: 7px 18px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}

.defect-cancel-btn:hover {
    background: var(--color-border);
}

/* ── Defect List ── */
.defect-list-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.defect-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
}

.defect-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.defect-priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.defect-priority-aog { background: #c53030; }
.defect-priority-a   { background: #dd6b20; }
.defect-priority-b   { background: #d69e2e; }
.defect-priority-c   { background: #2b6cb0; }

.defect-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #4a5568;
}

.defect-status-new {
    background: #bee3f8;
    color: #2a4365;
}

.defect-card-desc {
    font-size: 0.84rem;
    color: var(--color-text);
    line-height: 1.45;
    white-space: pre-wrap;
}

.defect-card-meta {
    font-size: 0.72rem;
    color: var(--color-text-light);
    margin-top: 6px;
}

/* ===== Defect Management Page ===== */
.defect-page-wrapper {
    max-width: 1200px;
}

.defect-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.defect-page-title {
    font-size: 1.3rem;
    color: var(--color-primary);
    font-weight: 700;
}

.defect-page-loading {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.defect-summary-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.defect-count-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.defect-count-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-left: 8px;
}

.defect-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.defect-table th,
.defect-table td {
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    text-align: left;
    font-size: 0.85rem;
}

.defect-table thead th {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.defect-table-row:hover {
    background: var(--color-hover);
}

.defect-table-desc {
    max-width: 300px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Defect ID button (clickable link style) ===== */
.defect-id-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--color-secondary);
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.defect-id-btn:hover {
    color: var(--color-primary);
}

/* ===== Defect Filter Bar ===== */
.defect-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.defect-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.defect-filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.defect-filter-group input[type="date"],
.defect-filter-group select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--color-text);
    background: #fff;
    height: 34px;
}

.defect-filter-clear {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--color-text-light);
    font-size: 0.82rem;
    cursor: pointer;
    height: 34px;
    align-self: flex-end;
}

.defect-filter-clear:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

/* ===== Defect Status Badge extra states ===== */
.defect-status-in-work    { background: #c6f6d5; color: #22543d; }
.defect-status-on-offer   { background: #feebc8; color: #7b341e; }
.defect-status-on-hold    { background: #e2e8f0; color: #4a5568; }
.defect-status-under-procurement { background: #e9d8fd; color: #553c9a; }
.defect-status-closed     { background: #2d3748; color: #e2e8f0; }
.defect-status-reopen     { background: #fed7d7; color: #822727; }

/* ===== Defect Detail Modal ===== */
#defect-detail-modal .modal-content {
    width: 640px;
    max-width: 96vw;
}

.defect-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.defect-detail-id {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--color-primary);
}

.defect-detail-fstd {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.defect-detail-meta {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-left: auto;
}

.defect-detail-desc {
    background: var(--color-hover);
    border-left: 3px solid var(--color-secondary);
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.88rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 16px;
}

.defect-detail-edit-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.defect-detail-edit-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 130px;
}

.defect-detail-edit-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.defect-detail-edit-group select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: #fff;
}

.defect-detail-save-btn {
    padding: 7px 20px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-end;
}

.defect-detail-save-btn:hover {
    background: var(--color-secondary);
}

.defect-detail-save-status {
    font-size: 0.8rem;
    color: #38a169;
    align-self: flex-end;
    font-weight: 600;
}

/* ===== Work Log ===== */
.defect-section-divider {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-light);
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
    margin-bottom: 12px;
}

.defect-log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    max-height: 220px;
    overflow-y: auto;
}

.defect-log-entry {
    background: var(--color-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 9px 12px;
}

.defect-log-note {
    font-size: 0.87rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 5px;
}

.defect-log-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.defect-log-empty {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
    margin-bottom: 12px;
}

.defect-log-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.defect-log-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.87rem;
    resize: vertical;
    min-height: 70px;
}

.defect-log-submit-btn {
    align-self: flex-end;
    padding: 7px 18px;
    background: var(--color-secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.defect-log-submit-btn:hover {
    background: var(--color-primary);
}

/* ===== Document List ===== */
.defect-doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.defect-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.defect-doc-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

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

.defect-doc-name {
    font-size: 0.87rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.defect-doc-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.defect-doc-download {
    font-size: 0.8rem;
    color: var(--color-secondary);
    text-decoration: none;
    font-weight: 600;
    flex-shrink: 0;
}

.defect-doc-download:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.defect-doc-empty {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
    margin-bottom: 10px;
}

.defect-doc-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--color-text-light);
    cursor: pointer;
    background: #fff;
}

.defect-doc-upload-label:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    background: var(--color-hover);
}

.defect-doc-uploading {
    font-size: 0.82rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        height: 100vh;
        z-index: 200;
        transition: left 0.25s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.collapsed {
        width: 220px;
        min-width: 220px;
    }

    .sidebar.collapsed .sidebar-label,
    .sidebar.collapsed .sidebar-title {
        display: inline;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar-backdrop.visible {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 199;
    }

    .mobile-menu-btn {
        display: inline-block;
    }

    .main-content {
        width: 100%;
    }

    .defect-table-desc {
        max-width: 200px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .navigation {
        justify-content: center;
    }

    .view-switcher {
        justify-content: center;
    }

    .filter-controls {
        text-align: center;
    }

    #date-label {
        min-width: auto;
    }

    .weekly-grid {
        grid-template-columns: 80px repeat(7, 1fr);
        font-size: 0.75rem;
    }

    .monthly-cell {
        min-height: 60px;
        padding: 4px;
    }

    .daily-table .session-label {
        width: 80px;
        min-width: 80px;
        padding: 8px;
    }

    #detail-modal .modal-content {
        width: 95vw;
    }

    .flog-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .flog-form-label {
        width: auto;
        min-width: auto;
    }
}

/* ===== Print Styles ===== */
@media print {
    /* Hide everything except the modal */
    body > *:not(#detail-modal) {
        display: none !important;
    }

    /* Show the modal full-page */
    #detail-modal {
        position: static !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        z-index: auto !important;
    }

    #detail-modal .modal-backdrop {
        display: none !important;
    }

    #detail-modal .modal-content {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border: none !important;
    }

    /* Hide close button and action buttons when printing */
    .modal-close,
    .flog-save-btn,
    .flog-print-btn,
    .flog-defect-btn,
    .flog-reopen-btn,
    .flog-status {
        display: none !important;
    }

    /* Clean up form inputs for print */
    .flog-form-input input[type="date"],
    .flog-form-input input[type="time"],
    .flog-form-input input[type="number"] {
        border: none !important;
        box-shadow: none !important;
        padding: 2px 0 !important;
        font-weight: 600 !important;
        background: transparent !important;
    }

    .flog-rating-label {
        border-color: #ccc !important;
        color: #999 !important;
    }

    .flog-rating-option input[type="radio"]:checked + .flog-rating-label {
        background: var(--color-primary) !important;
        border-color: var(--color-primary) !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .modal-fstd-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .flog-actions {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    .flog-divider {
        color: #000 !important;
    }

    /* Add header for print */
    .modal-header {
        border-bottom: 2px solid #000 !important;
        padding: 12px 0 !important;
    }

    .modal-header h3 {
        font-size: 1.2rem !important;
        color: #000 !important;
    }

    #modal-body {
        padding: 20px 0 !important;
    }

    .modal-row {
        border-bottom-color: #ddd !important;
    }
}

/* ─── PMT Schedule Gantt ──────────────────────────────────── */

.pmt-sched-fstd-row td {
    background: #eef2ff;
    padding: 5px 10px;
    border-top: 2px solid var(--color-primary);
    border-bottom: 1px solid #c7d0f0;
}

.pmt-sched-fstd-cell strong {
    font-size: 0.88rem;
}

.pm-anniv-badge {
    margin-left: 10px;
    font-size: 0.72rem;
    color: #666;
    font-weight: normal;
}

.pmt-sched-indent {
    min-width: 16px;
    width: 16px;
}

.pmt-freq-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* PM type colours — label chips & Gantt badges */
.pmt-badge-monthly    { background: #dbeafe; color: #1d4ed8; }
.pmt-badge-quarterly  { background: #ffedd5; color: #c2410c; }
.pmt-badge-semiannual { background: #f3e8ff; color: #7e22ce; }
.pmt-badge-annual     { background: #dcfce7; color: #15803d; }

/* Badge buttons in the schedule Gantt */
.pmt-sched-badge {
    min-width: 26px;
    padding: 2px 5px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.pmt-badge-monthly.pmt-sched-badge    { border-color: #93c5fd; }
.pmt-badge-quarterly.pmt-sched-badge  { border-color: #fdba74; }
.pmt-badge-semiannual.pmt-sched-badge { border-color: #d8b4fe; }
.pmt-badge-annual.pmt-sched-badge     { border-color: #86efac; }

/* Custom / overridden date — dashed border */
.pmt-badge-overridden { border-style: dashed !important; }

/* Past events */
.pmt-badge-past { opacity: 0.55; }

/* FSTD column header width */
.pmt-th-fstd { min-width: 90px; }

/* ─── Session cell time label ─────────────────────────────── */

.session-cell-time {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-text-light);
    letter-spacing: 0.02em;
    margin-bottom: 3px;
    opacity: 0.75;
}

.session-cell.empty .session-cell-time {
    opacity: 0.5;
}

.session-cell-dash {
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* ─── Admin — Session Times card ──────────────────────────── */

.admin-session-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.admin-session-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-session-lbl {
    width: 72px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
    flex-shrink: 0;
}

.admin-session-time-in {
    width: 110px;
    padding: 5px 8px;
    font-size: 0.82rem;
}

.admin-session-sep {
    color: var(--color-text-light);
    font-weight: 600;
}

/* ===== Reports Page ===== */
.reports-page-wrapper {
    padding: 24px;
    max-width: 900px;
}

.reports-page-header {
    margin-bottom: 24px;
}

.reports-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Export card */
.report-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.report-card-header {
    margin-bottom: 16px;
}

.report-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.report-card-desc {
    font-size: 0.875rem;
    color: var(--color-text-light);
    line-height: 1.55;
}

/* Filters row */
.report-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
}

.report-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.report-filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-filter-group input,
.report-filter-group select {
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--color-card);
    color: var(--color-text);
}

.report-filter-group input:focus,
.report-filter-group select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

/* Actions row */
.report-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.report-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: var(--color-secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.report-export-btn:hover {
    background: var(--color-primary);
}

.report-export-btn:disabled {
    background: var(--color-text-light);
    cursor: not-allowed;
}

.report-export-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
    font-style: italic;
}

.report-backup-status {
    font-size: 0.85rem;
    color: var(--color-success, #38a169);
    margin-right: 12px;
}

@media (max-width: 600px) {
    .reports-page-wrapper {
        padding: 16px;
    }

    .report-filters {
        flex-direction: column;
    }

    .report-filter-group {
        width: 100%;
    }

    .report-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== Notification Banner ===== */
.notification-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: #fefcbf;
    border-bottom: 2px solid #d69e2e;
    color: #744210;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
}

.notification-banner-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

#notification-banner-text {
    flex: 1;
    line-height: 1.4;
}

.notification-banner-dismiss {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #744210;
    opacity: 0.7;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.notification-banner-dismiss:hover {
    opacity: 1;
}

/* ===== Admin Page ===== */
.admin-access-denied {
    padding: 40px;
    text-align: center;
    color: var(--color-error);
    font-size: 1rem;
}

.admin-page-wrapper {
    padding: 24px;
    max-width: 860px;
}

.admin-page-header {
    margin-bottom: 24px;
}

/* ── Admin vertical tabs layout ── */
.admin-tabs-wrapper {
    display: flex;
    min-height: calc(100vh - 110px);
    overflow: hidden;
}

.admin-tabs-nav {
    width: 210px;
    flex-shrink: 0;
    background: #161b27;
    border-right: 1px solid #2d3748;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}

.admin-tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 11px 18px;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    color: #718096;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.admin-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.admin-tab-btn.active {
    background: rgba(49, 130, 206, 0.12);
    color: #90cdf4;
    border-left-color: #3182ce;
    font-weight: 600;
}

.admin-tab-icon {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.admin-tab-label {
    flex: 1;
}

.admin-tabs-content {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
    overflow-y: auto;
}

.admin-tab-panel .admin-card {
    max-width: 760px;
}

.admin-tabs-nav-group {
    padding: 14px 18px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4a5568;
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.admin-page-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Admin card */
.admin-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.admin-card-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.admin-card-danger-header {
    background: #fff5f5;
    border-bottom-color: #fed7d7;
}

.admin-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 0;
}

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

/* Form rows */
.admin-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.admin-form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--color-card);
    color: var(--color-text);
    width: 100%;
}

.admin-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.admin-input[readonly],
.admin-input-mono {
    background: var(--color-bg);
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

.admin-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    background: var(--color-card);
    color: var(--color-text);
    resize: vertical;
}

.admin-textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

/* Copy row */
.admin-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-copy-btn {
    padding: 8px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    color: var(--color-text);
    transition: background 0.15s;
}

.admin-copy-btn:hover {
    background: var(--color-hover);
}

/* Action row */
.admin-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Buttons */
.admin-btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.admin-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.admin-btn-primary {
    background: var(--color-secondary);
    color: #fff;
}

.admin-btn-primary:hover:not(:disabled) {
    background: var(--color-primary);
}

.admin-btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.admin-btn-secondary:hover:not(:disabled) {
    background: var(--color-hover);
}

.admin-btn-danger {
    background: #fc8181;
    color: #742a2a;
}

.admin-btn-danger:hover:not(:disabled) {
    background: #f56565;
}

.admin-btn-danger-strong {
    background: var(--color-error);
    color: #fff;
}

.admin-btn-danger-strong:hover:not(:disabled) {
    background: #c53030;
}

.admin-btn-danger-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #fff5f5;
    color: var(--color-error);
    border: 1px solid #fed7d7;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.admin-btn-danger-sm:hover:not(:disabled) {
    background: #fed7d7;
}

/* Status messages */
.admin-status {
    font-size: 0.85rem;
}

.admin-status-success {
    color: #276749;
    font-weight: 600;
}

.admin-status-error {
    color: var(--color-error);
    font-weight: 600;
}

/* Hints and states */
.admin-hint {
    font-size: 0.825rem;
    color: var(--color-text-light);
    margin-bottom: 14px;
    line-height: 1.5;
}

.admin-loading {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

.admin-error {
    color: var(--color-error);
    font-size: 0.875rem;
}

.admin-empty {
    color: var(--color-text-light);
    font-size: 0.875rem;
    font-style: italic;
}

.admin-cell-dim {
    color: var(--color-text-light);
}

/* User table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg);
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: var(--color-hover);
}

.admin-self-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--color-secondary);
    color: #fff;
    border-radius: 4px;
    vertical-align: middle;
}

.admin-email-cell {
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.admin-role-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-role-select {
    padding: 5px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--color-card);
    cursor: pointer;
}

.admin-user-table-wrap {
    overflow-x: auto;
}

/* FSTD list */
.admin-fstd-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 36px;
}

.admin-fstd-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
}

.admin-fstd-name {
    font-weight: 500;
    color: var(--color-text);
}

.admin-fstd-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    margin-top: 4px;
}

.admin-fstd-add-row .admin-input {
    max-width: 260px;
}

/* Toggle row */
.admin-toggle-row {
    margin-bottom: 16px;
}

.admin-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
}

.admin-toggle-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Danger zone */
.admin-danger-warning {
    padding: 10px 14px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: #742a2a;
    margin-bottom: 16px;
}

@media (max-width: 680px) {
    .admin-page-wrapper {
        padding: 16px;
    }

    .admin-fstd-add-row .admin-input {
        max-width: 100%;
        width: 100%;
    }

    .admin-action-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-copy-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ===== Kiosk Mode Toggle Button ===== */
.kiosk-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.kiosk-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

.kiosk-toggle-btn.kiosk-active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.8);
    color: #fff;
    font-weight: 600;
}

/* ===== Help Button ===== */
.help-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.help-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

/* ===== Help Modal ===== */
.help-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.help-modal-overlay.hidden { display: none; }

.help-modal {
    background: var(--color-bg-panel, #1e2330);
    border: 1px solid var(--color-border, #2e3650);
    border-radius: 12px;
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--color-border, #2e3650);
    flex-shrink: 0;
}
.help-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}
.help-modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--color-text-light, #8892a4);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.help-modal-close:hover { color: var(--color-text, #e0e6f0); }

.help-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

/* Tabs */
.help-tabs {
    display: flex;
    gap: 2px;
    padding: 12px 24px 0;
    border-bottom: 1px solid var(--color-border, #2e3650);
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.help-tabs::-webkit-scrollbar { display: none; }

.help-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text-light, #8892a4);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.help-tab:hover { color: var(--color-text, #e0e6f0); }
.help-tab.active {
    color: var(--color-accent, #4a90e2);
    border-bottom-color: var(--color-accent, #4a90e2);
}

/* Panels */
.help-panel {
    display: none;
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.help-panel.active { display: block; }

.help-panel h3 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}
.help-panel h4 {
    margin: 20px 0 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.help-panel p, .help-panel li {
    font-size: 0.88rem;
    color: #c8d0e0;
    line-height: 1.6;
    margin-bottom: 8px;
}
.help-panel ul, .help-panel ol {
    padding-left: 20px;
    margin-bottom: 12px;
}
.help-panel li { margin-bottom: 4px; }

.help-tip {
    background: rgba(74, 144, 226, 0.1);
    border-left: 3px solid var(--color-accent, #4a90e2);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    margin-top: 12px;
    color: #c8d0e0 !important;
}

/* Help Table */
.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 10px 0 16px;
}
.help-table th {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
    font-weight: 600;
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--color-border, #2e3650);
}
.help-table td {
    padding: 6px 10px;
    color: #c8d0e0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: top;
}

/* Priority badges */
.help-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
}
.help-badge.aog   { background: #c0392b; color: #fff; }
.help-badge.pri-a { background: #e67e22; color: #fff; }
.help-badge.pri-b { background: #f1c40f; color: #333; }
.help-badge.pri-c { background: #27ae60; color: #fff; }

/* Download button */
.help-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--color-accent, #4a90e2);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    margin: 10px 0 4px;
    transition: background 0.15s;
}
.help-download-btn:hover { background: #357abd; }

/* ===== Kiosk Training Defect Panel ===== */
.kiosk-defect-panel {
    margin: 20px 16px 8px;
    border: 2px solid #e53e3e;
    border-radius: 10px;
    overflow: hidden;
    background: #1a1f2e;
}

.kiosk-defect-panel-title {
    background: #e53e3e;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 16px;
    letter-spacing: 0.03em;
}

.kiosk-defect-none {
    padding: 14px 16px;
    color: #68d391;
    font-size: 0.9rem;
    font-style: italic;
}

.kiosk-defect-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 0.88rem;
}

.kiosk-defect-row:hover {
    background: rgba(255,255,255,0.04);
}

.kiosk-defect-priority {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.kiosk-pri-aog { background: #c0392b; color: #fff; }
.kiosk-pri-a   { background: #e67e22; color: #fff; }
.kiosk-pri-b   { background: #f1c40f; color: #333; }
.kiosk-pri-c   { background: #27ae60; color: #fff; }

.kiosk-defect-id {
    color: #90cdf4;
    font-weight: 600;
    flex-shrink: 0;
    min-width: 48px;
}

.kiosk-defect-desc {
    color: #e2e8f0;
    flex: 1;
}

.kiosk-defect-status {
    color: #a0aec0;
    font-size: 0.78rem;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ===== Kiosk Mode Layout ===== */
.kiosk-mode #sidebar,
.kiosk-mode #sidebar-backdrop {
    display: none !important;
}

.kiosk-mode #upload-btn-label,
.kiosk-mode #user-info,
.kiosk-mode #mobile-menu-btn {
    display: none !important;
}

/* Expand main content to full width when sidebar is hidden */
.kiosk-mode .main-content {
    width: 100%;
}

/* ===== Defect Category Badges ===== */
.defect-category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.defect-category-maintenance     { background: #fef3c7; color: #92400e; }
.defect-category-training        { background: #dbeafe; color: #1e40af; }
.defect-category-customer-request { background: #ede9fe; color: #5b21b6; }
.defect-category-none            { background: #e2e8f0; color: #718096; }

/* ===== Defect Detail — Raised By & FLOG Panel ===== */
.defect-detail-raised-by {
    font-size: 0.8rem;
    color: var(--color-text-light);
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 8px;
}

.defect-flog-panel {
    background: #f7fafc;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 10px 14px;
    margin: 8px 0 12px;
}

.defect-flog-panel-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.defect-flog-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.defect-flog-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.defect-flog-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-light);
}

.defect-flog-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ===== Sortable Table Headers ===== */
.defect-th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.defect-th-sortable:hover {
    background: rgba(99, 102, 241, 0.08);
}

.defect-th-sortable.sort-active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--color-primary, #6366f1);
}

.sort-indicator {
    font-size: 0.7rem;
    margin-left: 2px;
}

.sort-inactive {
    opacity: 0.35;
}

/* ===== Dashboard Page ===== */
.dashboard-wrapper {
    padding: 24px;
    max-width: 1200px;
}

.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.dashboard-subtitle {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-top: 2px;
}

.dashboard-loading,
.dashboard-error {
    color: var(--color-text-light);
    font-style: italic;
    padding: 12px 0;
}

.dashboard-error {
    color: var(--color-error);
}

/* KPI Row */
.dashboard-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    min-width: 160px;
    flex: 1;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-card.kpi-danger  { border-left-color: #e53e3e; }
.kpi-card.kpi-warning { border-left-color: #d69e2e; }
.kpi-card.kpi-ok      { border-left-color: #38a169; }
.kpi-card.kpi-neutral { border-left-color: var(--color-secondary); }

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-top: 2px;
}

.kpi-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.kpi-priority-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
}

.kpi-pri-aog { background: #e53e3e; }
.kpi-pri-a   { background: #dd6b20; }
.kpi-pri-b   { background: #d69e2e; }
.kpi-pri-c   { background: #38a169; }

/* Dashboard Sections */
.dashboard-recent-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .dashboard-recent-section { grid-template-columns: 1fr; }
}

.dashboard-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.dashboard-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.dashboard-empty {
    color: var(--color-text-light);
    font-style: italic;
    font-size: 0.875rem;
}

.dashboard-more {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 10px;
    font-style: italic;
}

/* Defect list */
.dashboard-defect-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dashboard-defect-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.dashboard-defect-priority {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    color: #fff;
    margin-top: 2px;
}

.dd-pri-aog { background: #e53e3e; }
.dd-pri-a   { background: #dd6b20; }
.dd-pri-b   { background: #d69e2e; }
.dd-pri-c   { background: #38a169; }

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

.dashboard-defect-desc {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.dashboard-defect-meta {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

/* Today's sessions table */
.dashboard-sessions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.dashboard-sessions-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-light);
    padding: 6px 8px;
    border-bottom: 2px solid var(--color-border);
}

.dashboard-sessions-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.dashboard-sessions-table tr:last-child td {
    border-bottom: none;
}

.ds-flog {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
}

.ds-flog.flog-complete { background: #c6f6d5; color: #276749; }
.ds-flog.flog-open     { background: #fefcbf; color: #7b6015; }
.ds-flog.flog-missing  { background: #edf2f7; color: #718096; }

.ds-none {
    color: var(--color-text-light);
}

/* ===== Session Completed (FLOG done) — green tile ===== */
.session-cell.session-flog-done {
    background: #c6f6d5;
    border-left: 4px solid #38a169;
}

/* ===== Session FLOG/Defect Indicators (Daily & Weekly views) ===== */
.session-indicators {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.session-flog-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.session-flog-dot.flog-complete { background: #38a169; }
.session-flog-dot.flog-open     { background: #d69e2e; }
.session-flog-dot.flog-missing  { background: #cbd5e0; }

.session-defect-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(0,0,0,0.12);
    color: #2d3748;
    padding: 1px 5px;
    border-radius: 8px;
    line-height: 1.4;
}

.session-defect-badge.defect-high {
    background: #e53e3e;
    color: #fff;
}

.wc-indicators {
    margin-top: 4px;
}

/* ===== Days Open Badge (Defect Table) ===== */
.days-open-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.days-open-normal   { background: #edf2f7; color: #4a5568; }
.days-open-warning  { background: #fefcbf; color: #7b6015; }
.days-open-critical { background: #fed7d7; color: #c53030; }

/* ===== New Defect Panel (Defect Page) ===== */
.new-defect-panel {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.new-defect-panel-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.new-defect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.new-defect-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.new-defect-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.new-defect-row input,
.new-defect-row select,
.new-defect-row textarea {
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    background: #fff;
    color: var(--color-text);
    resize: vertical;
}

.new-defect-desc-row {
    grid-column: 1 / -1;
}

.new-defect-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== FSTD Utilization Report ===== */
.util-results {
    margin-top: 16px;
    overflow-x: auto;
}

.util-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.util-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-light);
    padding: 8px 12px;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg);
}

.util-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.util-table tr:hover td {
    background: var(--color-hover);
}

.util-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.util-pct { font-weight: 700; }
.util-pct-high { color: #276749; }
.util-pct-mid  { color: #7b6015; }
.util-pct-low  { color: #c53030; }

.util-empty {
    color: var(--color-text-light);
    font-style: italic;
    padding: 12px 0;
}

.report-calc-btn {
    background: var(--color-secondary);
}

.report-calc-btn:hover {
    background: #1a4a8a;
}

/* ===== Admin Short Invite Code ===== */
.admin-invite-code {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--color-primary);
    background: var(--color-bg);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 6px 16px;
    user-select: all;
}

/* ===== FLOG Management Page ===== */
.flog-page-wrapper {
    padding: 24px;
    max-width: 1400px;
}

.flog-page-header {
    margin-bottom: 20px;
}

.flog-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
}

.flog-page-subtitle {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-top: 2px;
}

/* Filter bar */
.flog-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.flog-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flog-filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-light);
}

.flog-filter-input {
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    background: #fff;
    color: var(--color-text);
    min-width: 140px;
}

.flog-filter-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

.flog-filter-apply {
    justify-content: flex-end;
}

.flog-apply-btn {
    background: var(--color-secondary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 7px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.flog-apply-btn:hover {
    background: #1a4a8a;
}

/* Summary bar */
.flog-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.flog-sum-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    min-width: 110px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--color-border);
}

.flog-sum-chip.flog-sum-ok     { border-top-color: #38a169; }
.flog-sum-chip.flog-sum-warn   { border-top-color: #d69e2e; }
.flog-sum-chip.flog-sum-danger { border-top-color: #e53e3e; }

.flog-sum-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
}

.flog-sum-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-light);
    margin-top: 3px;
    white-space: nowrap;
}

/* Table */
.flog-table-wrap {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.flog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.flog-table thead th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-light);
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg);
    white-space: nowrap;
}

.flog-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

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

.flog-table tbody tr:hover td {
    background: var(--color-hover);
}

/* Row states */
.flog-row-done td {
    background: #f0fff4;
}

.flog-row-done:hover td {
    background: #e6ffed !important;
}

.flog-row-today td {
    background: #fffbeb;
}

.flog-row-today:hover td {
    background: #fef9db !important;
}

/* Cell types */
.flog-td-date {
    font-weight: 600;
    white-space: nowrap;
    color: var(--color-text);
}

.flog-td-session {
    white-space: nowrap;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    color: var(--color-text);
}

.flog-td-fstd {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    white-space: nowrap;
}

.flog-fstd-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.flog-td-light {
    color: var(--color-text-light);
}

.flog-td-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    white-space: nowrap;
}

.flog-td-rating {
    white-space: nowrap;
    color: #d69e2e;
    font-weight: 600;
}

/* Status badges */
.flog-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
    white-space: nowrap;
}

.flog-status-done {
    background: #c6f6d5;
    color: #276749;
}

.flog-status-pending {
    background: #edf2f7;
    color: #4a5568;
}

/* Lost time highlight */
.flog-lost-time {
    color: #c53030;
    font-weight: 700;
}

/* Today badge */
.flog-today-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--color-accent);
    color: #fff;
    padding: 1px 5px;
    border-radius: 6px;
    margin-left: 5px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Action buttons */
.flog-btn-fill,
.flog-btn-edit {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.flog-btn-fill {
    background: var(--color-secondary);
    color: #fff;
}

.flog-btn-fill:hover {
    background: #1a4a8a;
}

.flog-btn-edit {
    background: #edf2f7;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.flog-btn-edit:hover {
    background: #e2e8f0;
}

/* Empty / loading states */
.flog-empty,
.flog-loading {
    padding: 32px;
    text-align: center;
    color: var(--color-text-light);
    font-style: italic;
}

/* ===== Defect Detail — Wider Modal ===== */
#defect-detail-modal .modal-content {
    width: 740px;
}

/* ===== Defect Detail — Info Panel (read-only key-value grid) ===== */
.defect-info-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 6px 20px;
    background: #f7fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 14px;
}

/* display:contents lets each row's two children participate in the parent 2-col grid */
.defect-info-row {
    display: contents;
}

.defect-info-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.defect-info-value {
    font-size: 0.88rem;
    color: var(--color-text);
}

/* ===== Defect Detail — Section Label ("Defect Description") ===== */
.defect-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 14px 0 5px;
}

/* ===== Defect Detail — Edit Grid (4 columns × 2 rows) ===== */
.defect-detail-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 14px;
    padding: 14px 0 10px;
    border-top: 1px solid var(--color-border);
    margin-top: 14px;
}

/* Inputs inside the edit grid */
.defect-detail-edit-grid .defect-detail-edit-group input[type="text"],
.defect-detail-edit-grid .defect-detail-edit-group input[type="number"],
.defect-detail-edit-grid .defect-detail-edit-group select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    background: #fff;
    font-family: var(--font);
}

.defect-detail-edit-grid .defect-detail-edit-group input:focus,
.defect-detail-edit-grid .defect-detail-edit-group select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

/* ===== Defect Detail — Save Row ===== */
.defect-detail-save-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0 6px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 16px;
}

/* ===== Defect Detail — Save Status Error Modifier ===== */
.defect-save-error {
    color: var(--color-error);
}

/* ===== Defect Detail — Download PDF Button ===== */
.defect-print-btn {
    margin-left: auto;
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.defect-print-btn:hover {
    background: var(--color-primary);
    color: #fff;
}
.defect-print-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ===== Reports Page — New Elements ===== */
.report-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-light);
    padding: 18px 0 8px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 4px;
}

/* FSTD checkbox group */
.report-fstd-group {
    flex-direction: column;
    align-items: flex-start !important;
    min-width: 0;
}

.report-fstd-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 4px;
}

.report-fstd-check {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.83rem;
    cursor: pointer;
    white-space: nowrap;
}

.report-fstd-check-all {
    font-weight: 700;
    color: var(--color-secondary);
}

.report-fstd-check input[type="checkbox"] {
    accent-color: var(--color-secondary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Results container */
.report-results {
    margin-top: 14px;
    overflow-x: auto;
}

/* Totals row in results tables */
.report-totals-row td {
    background: #edf2f7;
    font-weight: 700;
}

/* Print PDF button (outlined variant) */
.report-print-btn {
    background: #fff;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary) !important;
}
.report-print-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: #fff;
}

/* ===== Morning Readiness — Schedule Badge ===== */
.daily-fstd-th {
    vertical-align: middle;
}
.mr-ready-badge {
    display: inline-flex;
    align-items: center;
    background: #38a169;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ===== Morning Readiness Page ===== */
.mr-page-wrapper {
    max-width: 760px;
}
.mr-page-subtitle {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin: 0 0 20px;
}
.mr-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.mr-fstd-select,
.mr-date-picker {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
}
.mr-fstd-select { min-width: 200px; }

.mr-checklist-area {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mr-no-template-notice {
    color: var(--color-text-light);
    font-size: 0.9rem;
    padding: 20px;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px dashed var(--color-border);
}

/* Task list */
.mr-task-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}

.mr-task-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: background 0.15s;
}
.mr-task-row:not(:last-of-type) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}
.mr-task-row + .mr-task-row {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.mr-task-row.mr-task-row-done {
    background: #f0fff4;
}
.mr-task-row.has-defect {
    background: #fff5f5;
}

.mr-task-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #38a169;
    flex-shrink: 0;
}

.mr-task-label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
}

.mr-raise-defect-btn {
    background: none;
    border: 1px solid #e53e3e;
    color: #e53e3e;
    padding: 3px 10px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: var(--font);
}
.mr-raise-defect-btn:hover {
    background: #e53e3e;
    color: #fff;
}
.mr-raise-defect-btn.hidden { display: none; }

.mr-task-defect-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: #e53e3e;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Inline defect form */
.mr-defect-form {
    padding: 14px 16px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 2px;
}
.mr-defect-form.hidden { display: none; }
.mr-defect-form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 2px;
}
.mr-defect-desc {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    resize: vertical;
    box-sizing: border-box;
}
.mr-defect-prio {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    width: 140px;
}
.mr-defect-form-btns {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Submit row */
.mr-submit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}
.mr-submit-btn {
    background: #38a169;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.2s;
}
.mr-submit-btn:hover:not(:disabled) { background: #2f855a; }
.mr-submit-btn:disabled { opacity: 0.5; cursor: default; }

/* Submitted view */
.mr-submitted-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f0fff4;
    border: 1.5px solid #68d391;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.mr-submitted-icon {
    font-size: 1.8rem;
    color: #38a169;
    font-weight: 700;
    line-height: 1;
}
.mr-submitted-title {
    font-size: 1rem;
    font-weight: 700;
    color: #276749;
}
.mr-submitted-meta {
    font-size: 0.8rem;
    color: #68d391;
    margin-top: 2px;
}

.mr-task-check-done {
    color: #38a169;
    font-weight: 700;
    font-size: 1rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== Morning Readiness — Admin Templates Card ===== */
.mr-admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mr-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    gap: 12px;
    flex-wrap: wrap;
}
.mr-admin-row-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mr-admin-fstd-name {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.9rem;
}
.mr-admin-task-count {
    font-size: 0.78rem;
    color: #38a169;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    padding: 2px 8px;
    border-radius: 10px;
}
.mr-admin-no-tasks {
    color: var(--color-text-light);
    background: var(--color-bg);
    border-color: var(--color-border);
}
.mr-admin-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.mr-admin-upload-label {
    background: var(--color-primary);
    color: #fff;
    padding: 5px 14px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.mr-admin-upload-label:hover { background: #2c5282; }
.mr-admin-status {
    font-size: 0.78rem;
    font-weight: 600;
}
.mr-admin-status.hidden { display: none; }
.mr-admin-status-ok    { color: #38a169; }
.mr-admin-status-error { color: #e53e3e; }
.admin-empty-note {
    font-size: 0.85rem;
    color: var(--color-text-light);
    font-style: italic;
}

/* ===== Preventive Maintenance — Page ===== */
.pm-page-wrapper { padding: 24px; }
.pm-page-subtitle { color: var(--color-text-light); font-size: 0.9rem; margin-bottom: 20px; }

.pm-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.pm-exec-controls {
    align-items: flex-end;
}
.pm-exec-date-grp {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pm-exec-date-lbl {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pm-exec-date-in {
    padding: 7px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    background: var(--color-bg);
    color: var(--color-text);
    min-width: 140px;
}
.pm-fstd-select, .pm-window-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--color-card);
    color: var(--color-text);
}
.pm-fstd-select { min-width: 240px; }

.pm-no-config-notice {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 0.9rem;
    color: #2b6cb0;
}

/* ── Anniversary bar ── */
.pm-anniv-bar {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.88rem;
}

/* ── Gantt table ── */
.pm-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--color-card);
    margin-bottom: 16px;
}

.pm-gantt-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
    white-space: nowrap;
}

.pm-th-task {
    position: sticky;
    left: 0;
    background: var(--color-primary);
    color: #fff;
    text-align: left;
    padding: 10px 14px;
    min-width: 220px;
    font-weight: 600;
    z-index: 2;
}
.pm-th-freq {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 12px;
    min-width: 100px;
    font-weight: 600;
}
.pm-th-month {
    background: #2c5282;
    color: #fff;
    padding: 10px 8px;
    min-width: 72px;
    text-align: center;
    font-weight: 500;
}
.pm-th-current-month {
    background: #d69e2e;
    color: #fff;
}

/* ── System header rows ── */
.pm-sys-row { background: #edf2f7; }
.pm-sys-cell {
    padding: 8px 14px;
    font-size: 0.83rem;
    color: var(--color-primary);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.pm-gen-badge {
    margin-left: 10px;
    background: #bee3f8;
    color: #2b6cb0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Task rows ── */
.pm-task-row:nth-child(even) { background: #f7fafc; }
.pm-task-row:hover { background: var(--color-hover); }

.pm-task-name {
    position: sticky;
    left: 0;
    background: inherit;
    padding: 7px 14px;
    font-size: 0.82rem;
    color: var(--color-text);
    z-index: 1;
    border-right: 1px solid var(--color-border);
    max-width: 280px;
    white-space: normal;
}
.pm-task-freq {
    padding: 7px 10px;
    color: var(--color-text-light);
    font-size: 0.78rem;
    white-space: nowrap;
    border-right: 1px solid var(--color-border);
}

/* ── Gantt cells ── */
.pm-cell {
    padding: 5px 4px;
    text-align: center;
    border-right: 1px solid #edf2f7;
    min-width: 72px;
}
.pm-cell-current { background: #fffbeb; }

/* ── Due badges ── */
.pm-due-badge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, transform 0.1s;
}
.pm-due-badge:hover { opacity: 0.82; transform: scale(1.05); }

.pm-badge-done     { background: #c6f6d5; color: #276749; }
.pm-badge-overdue  { background: #fed7d7; color: #c53030; }
.pm-badge-current  { background: #fefcbf; color: #975a16; }
.pm-badge-upcoming { background: #bee3f8; color: #2c5282; }

/* ── Legend ── */
.pm-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 4px;
    font-size: 0.78rem;
}
.pm-legend-hint { color: var(--color-text-light); font-style: italic; margin-left: 6px; }

/* ── Completion modal ── */
.pm-completion-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pm-completion-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}
.pm-completion-box {
    position: relative;
    z-index: 1;
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    min-width: 340px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pm-completion-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
}
.pm-completion-info {
    font-size: 0.85rem;
    color: var(--color-text-light);
    line-height: 1.5;
}
.pm-completion-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}
.pm-completion-date {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    box-sizing: border-box;
}
.pm-completion-notes {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    resize: vertical;
    box-sizing: border-box;
}
.pm-completion-btns {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

/* ===== Preventive Maintenance — Admin Sections ===== */

/* Task library form */
.pm-admin-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    background: #f7fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 20px;
}
.pm-admin-system-sel { min-width: 160px; }
.pm-admin-freq-sel   { min-width: 130px; }
.pm-admin-fixed-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}
.pm-admin-fixed-wrap.hidden { display: none; }
.pm-admin-fixed-num { width: 80px; }

/* Task library table */
.pm-admin-table-wrap { margin-top: 4px; }
.pm-admin-sys-block  { margin-bottom: 16px; }
.pm-admin-sys-hdr {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius) var(--radius) 0 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pm-admin-gen-hdr {
    background: #e2e8f0;
    color: #4a5568;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 12px;
}
.pm-admin-task-row {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    border-bottom: 1px solid #edf2f7;
    gap: 10px;
}
.pm-admin-task-row:last-child { border-bottom: none; }
.pm-admin-task-name {
    flex: 1;
    font-size: 0.83rem;
    color: var(--color-text);
}
.pm-admin-task-freq {
    font-size: 0.75rem;
    color: #2b6cb0;
    background: #ebf8ff;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

/* FSTD config */
.pm-admin-fstd-sel { min-width: 220px; margin-bottom: 14px; }
.pm-admin-config-area.hidden { display: none; }
.pm-admin-sys-table-label {
    font-size: 0.83rem;
    font-weight: 700;
    color: #4a5568;
    margin: 12px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pm-admin-sys-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.pm-admin-sys-config-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pm-admin-sys-config-name {
    width: 160px;
    min-width: 160px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}
.pm-admin-gen-input { flex: 1; max-width: 280px; }

/* ===== Sidebar — Hover Flyout Submenu ===== */
.sidebar-item-group {
    position: relative;
}
.sidebar-arrow {
    margin-left: auto;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: transform 0.2s;
    pointer-events: none;
}
.sidebar-item-group:hover .sidebar-arrow {
    transform: rotate(90deg);
    opacity: 1;
}
/* Bridge: fills the gap between parent button and flyout so mouse won't lose hover */
.sidebar-item-group::after {
    content: '';
    position: absolute;
    top: 0;
    right: -12px;
    width: 12px;
    height: 100%;
    display: none;
}
.sidebar-item-group:hover::after {
    display: block;
}
.sidebar-submenu {
    position: absolute;
    left: calc(100% + 2px);
    top: 0;
    background: var(--color-primary);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    min-width: 180px;
    padding: 6px 0;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 200;
}
.sidebar-item-group:hover .sidebar-submenu {
    opacity: 1;
    pointer-events: auto;
}
.sidebar-subitem {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sidebar-subitem:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.sidebar-subitem.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 600;
}

/* ===== Preventive Maintenance — Tab Bar ===== */
.pm-tab-bar {
    display: flex;
    gap: 2px;
    background: var(--color-border);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 4px 4px 0;
    border-bottom: 2px solid var(--color-border);
}
.pm-tab-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.pm-tab-btn:hover {
    background: rgba(255,255,255,0.7);
    color: var(--color-text);
}
.pm-tab-btn.active {
    background: var(--color-card);
    color: var(--color-primary);
    font-weight: 700;
    box-shadow: 0 -1px 0 2px var(--color-card);
}
.pm-tab-content {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    min-height: 300px;
    padding: 0;
}

/* ===== Preventive Maintenance — Execution Tab ===== */
.pm-exec-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.pm-exec-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.pm-exec-hdr {
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pm-exec-hdr-overdue  { background: #fed7d7; color: #742a2a; }
.pm-exec-hdr-current  { background: #feebc8; color: #744210; }
.pm-exec-hdr-upcoming { background: #bee3f8; color: #1a365d; }
.pm-exec-hdr-done     { background: #c6f6d5; color: #1c4532; }
.pm-exec-row {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    gap: 10px;
    border-top: 1px solid var(--color-border);
    background: var(--color-card);
    transition: background 0.12s;
}
.pm-exec-row:hover { background: var(--color-hover); }
.pm-exec-row-done {
    opacity: 0.65;
}
.pm-exec-row-info {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.pm-exec-system {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-primary);
    background: #ebf4ff;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
}
.pm-exec-task {
    font-size: 0.875rem;
    color: var(--color-text);
    flex: 1;
    min-width: 120px;
}
.pm-exec-freq {
    font-size: 0.75rem;
    color: var(--color-text-light);
    white-space: nowrap;
}
.pm-exec-date {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    background: var(--color-empty);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.pm-exec-done-meta {
    font-size: 0.78rem;
    color: var(--color-text-light);
    white-space: nowrap;
}
.pm-exec-done-notes {
    font-size: 0.78rem;
    color: var(--color-text);
    font-style: italic;
}
.pm-exec-mark-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.pm-exec-mark-btn:hover { background: var(--color-secondary); }
.pm-exec-undo-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.pm-exec-undo-btn:hover {
    background: var(--color-error-bg);
    color: var(--color-error);
    border-color: var(--color-error);
}

/* ===== Preventive Maintenance — System Config Tab ===== */
.pm-syscfg-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pm-syscfg-block {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.pm-syscfg-hdr {
    background: var(--color-empty);
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    display: flex;
    align-items: center;
}
.pm-syscfg-gen-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px 6px;
    min-height: 38px;
    align-items: center;
}
.pm-syscfg-gen-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ebf4ff;
    border: 1px solid #bee3f8;
    border-radius: 14px;
    padding: 3px 6px 3px 10px;
    font-size: 0.82rem;
    color: var(--color-primary);
    font-weight: 500;
}
.pm-syscfg-gen-label { white-space: nowrap; }
.pm-syscfg-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #718096;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
    transition: background 0.12s, color 0.12s;
}
.pm-syscfg-remove-btn:hover { background: #fed7d7; color: var(--color-error); }
.pm-syscfg-empty {
    font-size: 0.8rem;
    color: var(--color-text-light);
    font-style: italic;
}
.pm-syscfg-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 10px;
    border-top: 1px solid var(--color-border);
}
.pm-syscfg-add-input { flex: 1; max-width: 280px; }

/* Add System button row (top of System Config tab) */
.pm-syscfg-new-sys-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.pm-syscfg-new-sys-input {
    flex: 1;
    max-width: 320px;
}

/* Delete System button (custom systems only, inside .pm-syscfg-hdr) */
.pm-syscfg-delete-sys-btn {
    margin-left: auto;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.pm-syscfg-delete-sys-btn:hover {
    background: var(--color-error-bg);
}

/* ===== Preventive Maintenance — Tasks Tab Additions ===== */
.pm-tasks-upload-wrap {
    margin-top: 6px;
    margin-bottom: 14px;
    background: var(--color-empty);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.pm-tasks-upload-hdr {
    font-size: 0.875rem;
    margin-bottom: 4px;
    color: var(--color-text);
}
.pm-tasks-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.pm-tasks-upload-input {
    font-size: 0.85rem;
    color: var(--color-text);
    cursor: pointer;
}
.pm-admin-task-name-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.pm-task-ref-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: #e9d8fd;
    color: #553c9a;
    padding: 1px 6px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}
.pm-task-desc-input {
    resize: vertical;
    min-height: 52px;
}

/* ===== Technical Log Page ===== */
.techlog-wrap {
    padding: 24px;
    max-width: 1000px;
}
.techlog-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--color-card);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.techlog-ctrl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.techlog-ctrl-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.techlog-fstd-sel,
.techlog-date-input {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--color-bg);
    color: var(--color-text);
    min-width: 160px;
}
.techlog-gen-btn {
    padding: 8px 20px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    align-self: flex-end;
}
.techlog-gen-btn:hover { background: var(--color-primary-dark, #2563eb); }
.techlog-dl-btn {
    padding: 8px 18px;
    background: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    align-self: flex-end;
}
.techlog-dl-btn:hover { background: var(--color-primary); color: #fff; }
.techlog-report-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.techlog-report-hdr {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 4px;
}
.techlog-report-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
}
.techlog-report-range {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.techlog-section {
    background: var(--color-card);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.techlog-section-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text);
}
.techlog-section-body {
    padding: 4px 0;
}
.techlog-sub-hdr {
    padding: 8px 18px 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
}
.techlog-sub-hdr:first-child { border-top: none; margin-top: 0; }
.techlog-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.12s;
}
.techlog-row:last-child { border-bottom: none; }
.techlog-row:hover { background: var(--color-bg); }
.techlog-row-major {
    background: #fff8f0;
}
.techlog-row-major:hover { background: #fff0e0; }
.techlog-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-muted);
    flex-shrink: 0;
    margin-top: 6px;
}
.techlog-row-text {
    flex: 1;
    min-width: 0;
}
.techlog-meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}
.techlog-notes {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 2px;
}
.techlog-sub-text {
    font-size: 0.85rem;
    color: var(--color-text);
}
.techlog-prio-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 3px;
}
.techlog-prio-aog { background: #fed7d7; color: #c53030; }
.techlog-prio-a   { background: #feebc8; color: #c05621; }
.techlog-prio-b   { background: #bee3f8; color: #2b6cb0; }
.techlog-prio-c   { background: #e2e8f0; color: #4a5568; }
.techlog-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 18px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.techlog-stats span {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
.techlog-stats strong {
    color: var(--color-text);
}
.techlog-empty {
    padding: 16px 18px;
    font-size: 0.88rem;
    color: var(--color-text-muted);
    font-style: italic;
}
.techlog-msg {
    padding: 32px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}
.techlog-msg-error {
    padding: 16px 20px;
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: var(--radius);
    color: #c53030;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ── Technical Log cards ── */
.techlog-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.techlog-card-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.techlog-card-title {
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--color-text);
}
.techlog-add-entry-btn {
    font-size: 0.85rem;
    padding: 5px 14px;
}

/* ── LogBook add-entry form ── */
.techlog-lb-add-form {
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
    background: #f7faff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.techlog-lb-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.techlog-lb-eng-grp {
    flex: 1;
    min-width: 200px;
}
.techlog-lb-eng-grp input {
    width: 100%;
}
.techlog-lb-desc-grp {
    width: 100%;
}
.techlog-lb-desc-input {
    width: 100%;
    resize: vertical;
    min-height: 80px;
}
.techlog-lb-attach-input {
    font-size: 0.85rem;
    cursor: pointer;
}
.techlog-lb-form-btns {
    display: flex;
    gap: 8px;
}

/* ── LogBook entry list ── */
.techlog-lb-list {
    padding: 4px 0;
}
.techlog-lb-entry {
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.12s;
}
.techlog-lb-entry:last-child { border-bottom: none; }
.techlog-lb-entry:hover { background: var(--color-bg); }
.techlog-lb-entry-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.techlog-lb-entry-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    flex: 1;
}
.techlog-lb-del-btn {
    background: none;
    border: 1px solid var(--color-error);
    color: var(--color-error);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.techlog-lb-del-btn:hover { background: var(--color-error); color: #fff; }
.techlog-lb-entry-desc {
    font-size: 0.9rem;
    color: var(--color-text);
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.5;
}
.techlog-lb-attach {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.techlog-lb-attach-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.8rem;
}
.techlog-lb-attach-link:hover { text-decoration: underline; }

/* ── Report Generator checkboxes + buttons ── */
.techlog-chk-wrap {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--color-border);
}
.techlog-chk-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 8px;
}
.techlog-chk-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}
.techlog-chk-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88rem;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
}
.techlog-chk-item input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.techlog-rep-btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
}

/* ===== Kiosk Split Layout (75/25) ===== */
.kiosk-split-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 0 8px 16px;
    min-height: 0;
}

.kiosk-split-left {
    flex: 3;
    min-width: 0;
}

.kiosk-split-right {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 16px;
}

/* ===== Simulator Advisory Note Panel ===== */
.sim-advisory-panel {
    border-radius: 10px;
    overflow: hidden;
    background: #1a1f2e;
    border: 2px solid #4a5568;
}

.sim-advisory-panel.sim-advisory-kiosk {
    border-color: #3182ce;
}

.sim-advisory-panel-below {
    margin: 20px 16px 8px;
}

.sim-advisory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    background: #2d3748;
}

.sim-advisory-panel.sim-advisory-kiosk .sim-advisory-header {
    background: #3182ce;
}

.sim-advisory-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.sim-advisory-fyi-tag {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}

.sim-advisory-body {
    padding: 16px;
}

.sim-advisory-text {
    color: #e2e8f0;
    font-size: 0.93rem;
    line-height: 1.65;
    white-space: pre-wrap;
    min-height: 48px;
}

.sim-advisory-kiosk .sim-advisory-text {
    font-size: 1.05rem;
    color: #f7fafc;
}

.sim-advisory-empty {
    color: #718096;
    font-style: italic;
    font-size: 0.88rem;
}

.sim-advisory-updated {
    color: #718096;
    font-size: 0.76rem;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sim-advisory-edit-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #bee3f8;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.sim-advisory-edit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Rich-text editor (replaced textarea) ── */
.sim-advisory-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1a202c;
    border: 1px solid #4a5568;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 6px 8px;
    flex-wrap: wrap;
}

.sim-advisory-tool-btn {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 4px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    min-width: 28px;
    padding: 4px 6px;
    text-align: center;
    transition: background 0.15s;
}

.sim-advisory-tool-btn:hover {
    background: #3182ce;
    border-color: #3182ce;
}

.sim-advisory-tool-sep {
    width: 1px;
    height: 20px;
    background: #4a5568;
    margin: 0 4px;
    display: inline-block;
}

.sim-advisory-tool-label {
    color: #a0aec0;
    font-size: 0.78rem;
    margin-right: 2px;
    white-space: nowrap;
}

.sim-advisory-tool-select {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.82rem;
    padding: 3px 4px;
    cursor: pointer;
}

.sim-advisory-tool-color {
    width: 28px;
    height: 26px;
    border: 1px solid #4a5568;
    border-radius: 4px;
    padding: 1px;
    cursor: pointer;
    background: none;
}

.sim-advisory-editor {
    width: 100%;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 0 0 6px 6px;
    color: #e2e8f0;
    font-size: 0.9rem;
    padding: 10px;
    min-height: 120px;
    font-family: inherit;
    box-sizing: border-box;
    line-height: 1.6;
    outline: none;
}

.sim-advisory-editor:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 2px rgba(99, 179, 237, 0.15);
}

.sim-advisory-editor:empty::before {
    content: attr(data-placeholder);
    color: #718096;
    pointer-events: none;
}

.sim-advisory-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.sim-advisory-save-btn {
    background: #3182ce;
    border: none;
    color: #fff;
    padding: 6px 18px;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.sim-advisory-save-btn:hover:not(:disabled) {
    background: #2c73b8;
}

.sim-advisory-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sim-advisory-cancel-btn {
    background: transparent;
    border: 1px solid #4a5568;
    color: #a0aec0;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.sim-advisory-cancel-btn:hover {
    background: #2d3748;
}

.sim-advisory-err {
    color: #fc8181;
    font-size: 0.8rem;
}
