/* Machine Maintenance System CSS */

/* ---- Design tokens --------------------------------------------------- */
:root {
    --color-primary: #f2641a;
    --color-primary-dark: #d6510e;
    --color-primary-light: rgba(242,100,26,.12);
    --color-danger: #e74c3c;
    --color-danger-dark: #c0392b;
    --color-warning: #f39c12;
    --color-warning-dark: #e67e22;
    --color-success: #27ae60;
    --color-success-dark: #229954;
    --color-accent: #667eea;
    --color-accent-2: #764ba2;
    --color-text: #2c3e50;
    --color-text-muted: #7f8c8d;
    --color-border: #e1e8ed;
    --color-surface: #ffffff;
    --color-bg: #f5f6fa;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 15px;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.12);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

.mms-icon {
    vertical-align: middle;
    flex-shrink: 0;
}

/* Tinted icon badge - small colored square housing an mms_icon() */
.icon-badge {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-badge.danger { background: rgba(231,76,60,.1); color: var(--color-danger); }
.icon-badge.warning { background: rgba(243,156,18,.1); color: var(--color-warning); }
.icon-badge.success { background: rgba(39,174,96,.1); color: var(--color-success); }
.icon-badge.info { background: rgba(242,100,26,.1); color: var(--color-primary); }
.icon-badge.neutral { background: rgba(127,140,141,.12); color: var(--color-text-muted); }

.icon-badge.sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
}

/* Shared data table - replaces one-off table styling per page */
.data-table-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

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

.data-table th {
    text-align: left;
    padding: 14px 16px;
    background: var(--color-bg);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
}

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

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

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

/* Login Page Styles */
.login-page {
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 400px;
    width: 100%;
    padding: 40px;
    border: 1px solid var(--color-border);
}

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

.login-header h1 {
    color: var(--color-text);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 500;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--color-surface);
    color: var(--color-text);
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(242, 100, 26, 0.12);
}

.login-button {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.login-button:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 12px;
}

.login-form .error-message {
    margin-top: 15px;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 25px;
    }

    .login-header h1 {
        font-size: 24px;
    }
}

/* Main Layout - FIXED CONTRASTS */
#container {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

#main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: #f5f6fa;
}

/* Sidebar Styles - IMPROVED CONTRAST */
.sidebar-header {
    padding: 25px 20px;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: white;
    font-weight: 700;
}

.user-info {
    font-size: 14px;
}

.username {
    display: block;
    font-weight: 600;
    color: #ecf0f1;
}

.user-role {
    color: #bdc3c7;
    font-size: 12px;
}

.nav-menu {
    list-style: none;
    flex: 1;
    padding: 10px 0;
}

.nav-item {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active .nav-link {
    background-color: var(--color-primary);
    color: white;
}

.nav-icon {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-text {
    color: inherit;
}

.notification-badge {
    background: #e74c3c;
    color: white;
    border-radius: var(--radius-md);
    padding: 3px 8px;
    font-size: 11px;
    margin-left: auto;
    font-weight: bold;
}

.sidebar-alerts {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
}

.alert-danger {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: 1px solid #e74c3c;
}

.alert-warning {
    background: rgba(241, 196, 15, 0.9);
    color: #333;
    border: 1px solid #f1c40f;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 15px;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-link,
.logout-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #ecf0f1;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.settings-link:hover,
.logout-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

/* Top Header - dark, unified with the sidebar frame */
.top-header {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    padding: 16px 30px;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    margin-right: 15px;
    cursor: pointer;
    color: white;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-stats {
    display: flex;
    gap: 10px;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 6px 16px;
}

.stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-weight: bold;
    font-size: 16px;
    display: block;
    margin-top: 2px;
    color: white;
}

.stat-value.overdue {
    color: #ff8a73;
}

.stat-value.due-today {
    color: var(--color-primary);
}

.current-time {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}

/* Content Area - BETTER SPACING */
#content {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Header - white title card (Hector-style), not a full-width rule */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    padding: 18px 24px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.page-header h2 {
    font-size: 18px;
    color: var(--color-text);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-header h2 .header-count {
    color: var(--color-text-muted);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

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

/* Resource data table (Hector-style asset list) */
.resource-table-container {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

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

.resource-table th {
    text-align: left;
    padding: 14px 18px;
    background: var(--color-bg);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
}

.resource-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    vertical-align: middle;
    color: var(--color-text);
}

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

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

.resource-thumb {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resource-cell-primary {
    font-weight: 700;
    color: var(--color-text);
}

.resource-cell-secondary {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.resource-cell-flex {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--color-primary);
    color: white;
}

.pill-badge.outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.resource-row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.icon-action-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.icon-action-btn.danger:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* Tabbed detail card (Hector-style asset card) */
.detail-card-header {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-card-identity {
    display: flex;
    align-items: center;
    gap: 16px;
}

.detail-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-card-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
}

.detail-card-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 3px;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-bottom: none;
    padding: 0 25px;
    overflow-x: auto;
}

.detail-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.detail-tab-btn:hover {
    color: var(--color-text);
}

.detail-tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.detail-card-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 25px;
}

.detail-tab-panel {
    display: none;
}

.detail-tab-panel.active {
    display: block;
}

/* The [hidden] attribute is overridden by any class below that sets its own
   display (e.g. .btn's display:inline-flex) since author CSS beats the
   browser's default UA stylesheet regardless of specificity - this restores it. */
[hidden] {
    display: none !important;
}

/* Buttons */
.btn {
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.4;
    border: 2px solid transparent;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-secondary:hover {
    background: var(--color-bg);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--color-danger-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}

.btn-warning:hover {
    background: var(--color-warning-dark);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: var(--color-success-dark);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Shared flat list row — used by workorders and complete-task lists */
.wo-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.15s;
}

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

.wo-row:hover {
    background: var(--color-bg);
}

.wo-check {
    padding-top: 2px;
    flex-shrink: 0;
}

.wo-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

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

.wo-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.wo-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.wo-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    align-items: center;
}

.wo-location {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.wo-description {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 4px;
}


/* Dashboard Styles - BETTER CARDS */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-stats,
.stats-strip {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.stat-card {
    background: var(--color-surface);
    padding: 14px 20px;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 190px;
    border: none;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.stat-card:last-child {
    border-right: none;
}

.stat-card .icon-badge {
    font-size: 20px;
}

.stat-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: none;
    color: var(--color-text-muted);
}

.stat-card.alert-danger .stat-icon,
.stat-card.alert-warning .stat-icon,
.stat-card.alert-info .stat-icon,
.stat-card.alert-success .stat-icon {
    background: none;
    color: var(--color-text-muted);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: none;
    font-weight: 500;
    letter-spacing: 0;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Two-column shell: primary maintenance panels + a narrower activity/actions rail */
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 16px;
    align-items: start;
}

.dashboard-main,
.dashboard-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

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

.dashboard-card,
.panel {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    box-shadow: none;
    border: 1px solid var(--color-border);
}

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

.card-header h3 {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
}

.dashboard-card .card-header,
.panel .panel-header {
    background: none;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-card .card-header h3,
.panel .panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-card .card-header h3 .mms-icon,
.panel .panel-header h3 .mms-icon {
    color: var(--color-text-muted);
}

.card-header-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
}

.card-header-link:hover {
    text-decoration: underline;
}

.card-content {
    padding: 25px;
}

.dashboard-card .card-content,
.panel .panel-content {
    padding: 16px 20px 20px;
}

.card-actions {
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    text-align: right;
}

.dashboard-card .card-actions,
.panel .panel-actions {
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    text-align: right;
}

/* Unified dashboard list item - used by critical overdue, upcoming maintenance
   and recent activity panels so all three share one visual pattern instead of
   each having its own one-off row style. */
.dashboard-list,
.flat-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.dashboard-list-item,
.flat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    background: none;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.dashboard-list-item:last-child,
.flat-list-item:last-child {
    border-bottom: none;
}

a.dashboard-list-item:hover,
a.flat-list-item:hover {
    background: var(--color-bg);
}

.dashboard-dot,
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    flex-shrink: 0;
}

.dashboard-dot.danger, .status-dot.danger { background: var(--color-danger); }
.dashboard-dot.warning, .status-dot.warning { background: var(--color-warning); }
.dashboard-dot.info, .status-dot.info { background: var(--color-primary); }
.dashboard-dot.success, .status-dot.success { background: var(--color-success); }

.dashboard-list-body,
.flat-list-body {
    flex: 1;
    min-width: 0;
}

.dashboard-list-title,
.flat-list-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.dashboard-list-sub,
.flat-list-sub {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-list-meta,
.flat-list-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.dashboard-list-meta .meta-date,
.flat-list-meta .meta-date {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.dashboard-list-meta .meta-urgent,
.flat-list-meta .meta-urgent {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-danger-dark);
    white-space: nowrap;
}

/* Generic key-value detail card (machine details, completion summary, etc.) */
.details-card,
.item-summary {
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    box-shadow: none;
    padding: 20px;
    border: 1px solid var(--color-border);
    height: fit-content;
    margin-bottom: 25px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.detail-item.full-width {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.detail-item label {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 14px;
}

.detail-item value {
    color: var(--color-text);
    font-weight: 500;
    text-align: right;
}

.detail-item.full-width value {
    text-align: left;
    line-height: 1.5;
}

/* Generic section header (title + action button) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h3 {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
}

/* Generic item header (title + badges row), used inside item/summary cards */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
    gap: 12px;
    flex-wrap: wrap;
}

.item-header h3 {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.item-header h4 {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.item-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Machine Details: maintenance item cards */
.maintenance-items-section {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 25px;
    border: 1px solid var(--color-border);
}

.maintenance-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.maintenance-item {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    padding: 18px;
}

.maintenance-item .item-details p {
    color: var(--color-text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.item-schedule {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.schedule-item {
    display: flex;
    flex-direction: column;
}

.schedule-item label {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.schedule-item value {
    color: var(--color-text);
    font-size: 14px;
}

/* Priority and Status Badges - tinted pills */
.priority-badge,
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 0.4px;
}

.priority-critical {
    background: rgba(231,76,60,.12);
    color: var(--color-danger-dark);
}

.priority-high {
    background: rgba(243,156,18,.14);
    color: var(--color-warning-dark);
}

.priority-medium {
    background: rgba(241,196,15,.18);
    color: #8a6d00;
}

.priority-low {
    background: rgba(39,174,96,.12);
    color: var(--color-success-dark);
}

.status-badge.overdue {
    background: rgba(231,76,60,.12);
    color: var(--color-danger-dark);
}

.status-badge.due-today {
    background: rgba(243,156,18,.14);
    color: var(--color-warning-dark);
}

.status-badge.due-soon {
    background: rgba(242,100,26,.12);
    color: var(--color-primary-dark);
}

.status-badge.current {
    background: rgba(39,174,96,.12);
    color: var(--color-success-dark);
}

.status-badge.active {
    background: rgba(39,174,96,.12);
    color: var(--color-success-dark);
}

.status-badge.inactive {
    background: rgba(127,140,141,.14);
    color: var(--color-text-muted);
}

/* Forms - MUCH BETTER STYLING */
.form-container {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid var(--color-border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(242, 100, 26, 0.12);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--color-border);
}

/* Machine Cards - IMPROVED */
.machines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 25px;
}

.machine-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
}

.machine-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

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

.machine-header h3 {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
}

.machine-status {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.machine-info h4 {
    color: #34495e;
    margin-bottom: 12px;
    font-size: 16px;
}

.machine-info p {
    color: var(--color-text-muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.machine-details {
    margin: 20px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.detail-row .label {
    color: var(--color-text-muted);
    font-weight: 500;
}

.detail-row .value {
    color: var(--color-text);
    font-weight: 600;
}

.machine-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--color-border);
    flex-wrap: wrap;
}

/* Messages - BETTER VISIBILITY */
.success-message,
.error-message {
    padding: 18px 24px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-weight: 600;
    border: 2px solid;
}

.success-message {
    background: #d4edda;
    border-color: #27ae60;
    color: #155724;
}

.error-message {
    background: #f8d7da;
    border-color: #e74c3c;
    color: #721c24;
}

.no-data {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
}

.no-data h3 {
    color: var(--color-text);
    margin-bottom: 15px;
    font-size: 24px;
}

/* Search and Filters - BETTER STYLING */
.filter-section {
    background: var(--color-surface);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
}

.filter-section h3 {
    color: var(--color-text);
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.filter-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-controls select,
.filter-controls input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-width: 160px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
}

.filter-controls select:focus,
.filter-controls input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* List Controls - FIXED SEARCH BAR */
.list-controls {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--color-border);
    border-radius: 25px;
    font-size: 16px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(242, 100, 26, 0.12);
}

.search-box input::placeholder {
    color: var(--color-text-muted);
}

/* Quick Actions - FIXED STYLING */
.quick-actions {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.quick-actions .card-header {
    background: var(--color-bg);
    padding: 25px;
    border-bottom: 1px solid var(--color-border);
}

.quick-actions .card-header h3 {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.quick-actions .card-content {
    padding: 25px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    transition: all 0.3s ease;
    text-align: center;
}

.action-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(242, 100, 26, 0.3);
}

.action-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.action-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* Narrow vertical quick-action list, for the dashboard side rail where the
   tile grid above is too wide to lay out usefully. */
.quick-action-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 0.15s ease;
}

.quick-action-row:hover {
    background: var(--color-bg);
}

.quick-action-row .action-text {
    font-size: 14px;
    font-weight: 600;
}

/* Responsive Design - IMPROVED */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    #main-content {
        margin-left: 0;
    }
    
    .mobile-nav-toggle {
        display: block !important;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    .machines-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .header-stats {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-controls select,
    .filter-controls input {
        min-width: 100%;
    }
    
    #content {
        padding: 20px 15px;
    }
    
    .form-container {
        padding: 25px 20px;
    }
    
    .machine-actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .login-container {
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .stat-card {
        padding: 20px 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .stat-number {
        font-size: 28px;
    }
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.menu-overlay.active {
    display: block;
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.mobile-nav-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* Focus States for Accessibility */
.btn:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

.nav-link:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        font-size: 12pt;
        color: black;
    }
    
    .page-break {
        page-break-before: always;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.p-2 { padding: 0.5rem; }

/* Notification Banner (dashboard "enable push notifications" prompt) */
.notification-banner {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.notification-icon {
    flex-shrink: 0;
    color: white;
}

.notification-text {
    flex: 1;
    min-width: 250px;
    color: white;
}

.notification-text h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.notification-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    color: white;
}

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

.notification-actions .btn {
    white-space: nowrap;
}

.notification-actions .btn-primary {
    background: var(--color-primary);
    color: white;
}

.notification-actions .btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.notification-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: transparent;
}

.notification-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
    .notification-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .notification-actions {
        width: 100%;
        justify-content: center;
    }

    .notification-actions .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
