/* CONVERSA MRO Web - minimal stylesheet */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f5f6f8;
    color: #222;
}

.container {
    max-width: 900px;
    margin: 24px auto;
    padding: 0 16px;
}

/* Top navigation */
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e3a5f;
    color: white;
    padding: 12px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topnav .brand {
    font-weight: bold;
    font-size: 1.1em;
}

.topnav .nav-links a {
    color: white;
    text-decoration: none;
    margin: 0 12px;
    padding: 6px 12px;
    border-radius: 4px;
}

.topnav .nav-links a:hover {
    background: rgba(255,255,255,0.1);
}

.topnav .nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9em;
}

.topnav .nav-user .btn-link {
    color: white;
    text-decoration: underline;
}

/* Login page */
.login-box {
    max-width: 380px;
    margin: 80px auto;
    background: white;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.login-box h1 {
    text-align: center;
    margin: 0 0 4px 0;
    color: #1e3a5f;
}

.login-box .subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 24px 0;
    font-size: 0.9em;
}

.login-box label {
    display: block;
    margin-bottom: 14px;
    font-size: 0.9em;
    color: #444;
}

.login-box input {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #1e3a5f;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 8px;
}

.login-box button:hover {
    background: #2a4e7a;
}

.error {
    background: #ffe0e0;
    color: #a00;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9em;
}

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

.page-header h1 {
    margin: 0;
    color: #1e3a5f;
}

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

.filter-btn {
    padding: 6px 14px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
}

.filter-btn.active {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
}

.btn-secondary {
    padding: 6px 14px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-secondary:hover { background: #ddd; }

.btn-link {
    background: none;
    border: none;
    color: #1e3a5f;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-size: 0.9em;
}

/* Notification list */
.notif-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notif-item {
    background: white;
    padding: 16px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid #ccc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.notif-item.unread {
    border-left-color: #1e3a5f;
    background: #f7faff;
}

.notif-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #888;
    margin-bottom: 6px;
}

.notif-category {
    background: #e0e7f0;
    color: #1e3a5f;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}

.notif-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.notif-item.unread .notif-title {
    font-weight: 700;
}

.notif-message {
    color: #555;
    font-size: 0.95em;
    margin-bottom: 6px;
}

.notif-ref {
    font-size: 0.8em;
    color: #888;
    font-style: italic;
}

.empty {
    text-align: center;
    color: #888;
    padding: 40px;
    background: white;
    border-radius: 6px;
}

/* Dashboard */
.welcome {
    color: #666;
    font-size: 0.95em;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid #ccc;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: relative;
}

.kpi-card .kpi-label {
    font-size: 0.85em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-card .kpi-value {
    font-size: 2.4em;
    font-weight: 700;
    color: #222;
    line-height: 1;
}

.kpi-card .kpi-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.85em;
    color: #1e3a5f;
}

.kpi-blue { border-left-color: #1e3a5f; }
.kpi-orange { border-left-color: #e07b1f; }
.kpi-red { border-left-color: #c62828; }
.kpi-green { border-left-color: #2e7d32; }

.dash-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.dash-section h2 {
    margin: 0 0 14px 0;
    font-size: 1.1em;
    color: #1e3a5f;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

.data-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #e0e0e0;
    color: #666;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

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

.data-table .row-red { color: #c62828; font-weight: 600; }
.data-table .row-orange { color: #e07b1f; font-weight: 600; }
.data-table .row-grey { color: #999; }

.empty-small {
    color: #888;
    font-size: 0.9em;
    padding: 10px 0;
    margin: 0;
}

/* Clickable table rows */
.data-table.clickable tbody tr {
    cursor: pointer;
}
.data-table.clickable tbody tr:hover {
    background: #f0f4fa;
}

/* Request detail page */
.req-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px 24px;
    font-size: 0.95em;
}
.req-header-grid .lbl {
    color: #888;
    font-size: 0.85em;
    text-transform: uppercase;
    margin-right: 6px;
}
.req-notes {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
    color: #555;
    font-size: 0.95em;
}

.req-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 8px 16px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
}
.btn-primary:hover { background: #1b5e20; }

.btn-danger {
    padding: 8px 16px;
    background: #c62828;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
}
.btn-danger:hover { background: #8e0000; }

/* Line status row colors */
.line-approved td:nth-child(4) { color: #2e7d32; font-weight: 600; }
.line-denied td:nth-child(4) { color: #c62828; font-weight: 600; }
.line-back-order td:nth-child(4) { color: #e07b1f; font-weight: 600; }
.line-ordered td:nth-child(4) { color: #1565c0; font-weight: 600; }
.line-received td:nth-child(4) { color: #999; font-weight: 600; }

/* Mini action buttons */
.btn-mini {
    padding: 4px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.95em;
    margin: 0 1px;
    min-width: 28px;
}
.btn-approve { background: #2e7d32; color: white; }
.btn-approve:hover { background: #1b5e20; }
.btn-deny { background: #c62828; color: white; }
.btn-deny:hover { background: #8e0000; }
.btn-backorder { background: #e07b1f; color: white; font-size: 0.75em; font-weight: bold; }
.btn-backorder:hover { background: #b35c10; }

/* Search bar */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
    background: white;
    padding: 14px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.search-bar input[type="text"] {
    flex: 1 1 280px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

.search-bar select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    background: white;
}

.chk-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #555;
}

.results-count {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 8px;
}

/* Data table extras */
.data-table th.right,
.data-table td.right {
    text-align: right;
}

.data-table .row-preferred {
    background: #fffbe6;
}

/* Detail grid (sidebar with image) */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-main .dash-section {
    margin-bottom: 0;
}

.detail-image {
    max-width: 320px;
}

.detail-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: white;
}

/* Signature grid for work orders */
.sig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.sig-block {
    background: #f7faff;
    border: 1px solid #e0e7f0;
    border-radius: 6px;
    padding: 14px;
    text-align: center;
}

.sig-block .sig-label {
    font-size: 0.8em;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sig-block .sig-name {
    font-weight: 600;
    font-size: 1em;
    color: #1e3a5f;
    margin-bottom: 4px;
}

.sig-block .sig-date {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 8px;
}

.sig-block .sig-empty {
    font-size: 0.9em;
    color: #aaa;
    font-style: italic;
    margin-bottom: 10px;
}

/* Form elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.form-grid label,
.full-width {
    display: block;
    font-size: 0.85em;
    color: #555;
    font-weight: 500;
}

.form-grid select,
.form-grid input,
.full-width textarea,
.full-width input {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
    font-family: inherit;
}

.full-width {
    display: block;
    margin-bottom: 10px;
}

.readonly-value {
    padding: 8px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-top: 4px;
    font-size: 0.95em;
}

/* Part picker for request creation */
.add-line-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.add-line-form h3 {
    font-size: 1em;
    color: #1e3a5f;
    margin: 0 0 12px 0;
}

.part-picker {
    position: relative;
    margin-bottom: 12px;
}

.part-picker input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}

.part-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.part-result {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
}

.part-result:hover {
    background: #f0f4fa;
}

.part-result:last-child {
    border-bottom: none;
}

.selected-part {
    margin-top: 8px;
    padding: 10px;
    background: #f0f4fa;
    border-radius: 4px;
    font-size: 0.9em;
    min-height: 20px;
}

.selected-part:empty::before {
    content: "No part selected";
    color: #999;
    font-style: italic;
}

.qty-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.qty-row label {
    flex: 1;
    font-size: 0.85em;
    color: #555;
}

.qty-row input[type="number"] {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box;
}

/* Flash messages (error/success banners) */
.flash {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 0.95em;
    border-left: 4px solid;
}

.flash-error {
    background: #fdeaea;
    border-left-color: #c62828;
    color: #8b1e1e;
}

.flash-success {
    background: #e6f4ea;
    border-left-color: #2e7d32;
    color: #1b5e20;
}

/* Fuel tank cards */
.tank-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.tank-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e0e7f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: relative;
}

.tank-card.tank-low { border-color: #c62828; }
.tank-card.tank-full { border-color: #2e7d32; }
.tank-card.tank-ok { border-color: #1e3a5f; }

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

.tank-header .tank-name {
    font-weight: 700;
    font-size: 1.1em;
    color: #1e3a5f;
}

.tank-header .tank-pct {
    font-size: 1.4em;
    font-weight: 700;
    color: #666;
}

.tank-low .tank-header .tank-pct { color: #c62828; }
.tank-full .tank-header .tank-pct { color: #2e7d32; }

.tank-level {
    height: 24px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.tank-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.tank-fill-low { background: linear-gradient(90deg, #c62828, #ef5350); }
.tank-fill-ok { background: linear-gradient(90deg, #1e3a5f, #3b5a85); }
.tank-fill-full { background: linear-gradient(90deg, #2e7d32, #66bb6a); }

.tank-stats {
    font-size: 0.95em;
    color: #444;
}

.tank-stats strong {
    color: #1e3a5f;
    font-size: 1.2em;
}

.tank-low .tank-stats strong { color: #c62828; }
.tank-full .tank-stats strong { color: #2e7d32; }

.tank-alert {
    margin-top: 10px;
    padding: 6px 10px;
    background: #c62828;
    color: white;
    border-radius: 4px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

/* Fuel forms side-by-side */
.fuel-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.fuel-form {
    background: #f7faff;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e0e7f0;
}

.fuel-form h3 {
    margin: 0 0 12px 0;
    font-size: 1em;
    color: #1e3a5f;
}

.fuel-form button {
    margin-top: 12px;
}

/* Inline line edit form (PO detail) */
.inline-edit-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.inline-edit-form .qty-input {
    width: 70px;
    padding: 4px 6px;
    text-align: right;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
}

.inline-edit-form .price-input {
    width: 100px;
    padding: 4px 6px;
    text-align: right;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
}

.inline-edit-form .line-total {
    font-weight: 600;
    font-size: 0.9em;
    min-width: 80px;
    text-align: right;
    color: #1e3a5f;
}

/* Condition tags */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 600;
    color: white;
}
.tag-yellow { background: #e6a820; }
.tag-green { background: #2e7d32; }
.tag-red { background: #c62828; }
.tag-blue { background: #1565c0; }
.tag-none { background: #999; }

/* Responsive */
@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-image {
        max-width: 100%;
    }
    .topnav {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
