/* Nich-Chem Load Ledger — branded theme */
:root {
    --green: #006B21;
    --green-dark: #00541A;
    --green-light: #E8F5E9;
    --green-mid: #C8E6C9;
    --sidebar-bg: #F8F9FA;
    --sidebar-active: #E8F5E9;
    --white: #FFFFFF;
    --text: #1A1A1A;
    --text-light: #555555;
    --text-lighter: #999999;
    --border: #E0E0E0;
    --star-color: #E8A817;
    --check-green: #2E7D32;
    --red: #C62828;
    --overdue: #C62828;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', sans-serif;
    font-size: 16px;
    color: var(--text);
    background: #F0F2F5;
    -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(145deg, #004D18 0%, #006B21 40%, #1B8A3A 100%);
    background-attachment: fixed;
}

.login-container {
    background: var(--white);
    border-radius: 16px;
    padding: 48px 44px 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 460px;
    width: 92%;
}

.login-header { margin-bottom: 32px; }

.login-logo {
    height: 48px;
    margin-bottom: 16px;
}

.login-divider {
    width: 60px;
    height: 3px;
    background: var(--green);
    margin: 0 auto 16px;
    border-radius: 2px;
}

.login-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-light);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-prompt {
    font-size: 14px;
    color: var(--text-lighter);
    margin-bottom: 20px;
}

.user-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.user-btn {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 20px 16px; background: var(--sidebar-bg); border: 2px solid transparent;
    border-radius: var(--radius); cursor: pointer; transition: all 0.2s ease;
    font-size: 15px; font-weight: 500; color: var(--text); font-family: inherit;
}
.user-btn:hover {
    border-color: var(--green);
    background: var(--green-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,107,33,0.3);
}

.login-step { }

.login-error {
    background: #FDEDED; color: #C62828; padding: 10px 16px; border-radius: var(--radius-sm);
    font-size: 14px; margin-bottom: 16px; text-align: center;
}

.password-row {
    display: flex; gap: 10px; margin-bottom: 16px;
}

.password-input {
    flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 16px; font-family: inherit; color: var(--text); outline: none;
    transition: border-color 0.15s;
}
.password-input:focus { border-color: var(--green); }

.login-btn {
    background: linear-gradient(135deg, #006B21, #1B8A3A); color: white;
    border: none; padding: 12px 24px; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.15s; white-space: nowrap;
}
.login-btn:hover { background: linear-gradient(135deg, #00541A, #006B21); }

.back-link {
    background: none; border: none; color: var(--text-lighter); font-size: 14px;
    cursor: pointer; font-family: inherit; transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.login-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-lighter);
    letter-spacing: 0.5px;
}

/* ==================== APP LAYOUT ==================== */
.app-layout { display: flex; min-height: 100vh; }

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 270px; background: var(--white); display: flex;
    flex-direction: column; border-right: 1px solid var(--border);
    flex-shrink: 0; box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}

.sidebar-header {
    padding: 24px 22px 18px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-logo {
    height: 32px;
    margin-bottom: 6px;
}

.sidebar-subtitle {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-lighter);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 22px; margin: 2px 10px;
    text-decoration: none; color: var(--text); font-size: 15px;
    transition: all 0.15s; border-radius: 8px;
}
.nav-item:hover { background: var(--sidebar-bg); }
.nav-item.active {
    background: var(--green-light);
    color: var(--green);
    font-weight: 600;
}
.nav-icon { font-size: 20px; width: 28px; text-align: center; display: flex; align-items: center; justify-content: center; }

/* Tanker truck SVG icons */
.tanker-icon { width: 28px; }
.tanker-svg { width: 26px; height: auto; filter: brightness(0) saturate(100%) invert(25%) sepia(5%) saturate(500%) hue-rotate(180deg); }
.tanker-svg.tanker-lg { width: 30px; }
.nav-item.active .tanker-svg { filter: brightness(0) saturate(100%) invert(23%) sepia(99%) saturate(1200%) hue-rotate(125deg) brightness(70%); }
.tanker-svg-header { width: 36px; height: auto; filter: brightness(0) invert(1); vertical-align: middle; margin-right: 6px; }
.tanker-svg-header.tanker-lg { width: 42px; }
.tanker-svg-empty { width: 80px; height: auto; filter: brightness(0) saturate(100%) invert(70%); }
.tanker-svg-empty.tanker-lg { width: 96px; }
.header-tanker { display: inline; }

.sidebar-footer {
    padding: 16px 22px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.current-user { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.user-avatar-sm {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.logout-link { font-size: 13px; color: var(--text-lighter); text-decoration: none; }
.logout-link:hover { color: var(--red); }

/* ==================== MAIN CONTENT ==================== */
.main-content { flex: 1; padding: 0; background: #F0F2F5; overflow-y: auto; }

.list-header {
    padding: 28px 36px 22px;
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white;
    box-shadow: 0 2px 8px rgba(0,107,33,0.2);
}
.list-header h1 { font-size: 24px; font-weight: 600; }

/* ==================== ADD FORM ==================== */
.add-form {
    margin: -8px 36px 0; background: var(--white);
    border-radius: var(--radius); box-shadow: var(--shadow);
    position: relative; z-index: 1;
}

.add-row { display: flex; align-items: center; gap: 12px; padding: 16px 20px; }
.add-icon { font-size: 16px; color: var(--green); }
.add-input {
    flex: 1; border: none; outline: none; font-size: 16px;
    font-family: inherit; color: var(--text); background: transparent;
}
.add-input::placeholder { color: var(--text-lighter); }

.add-extras { padding: 0 20px 14px; display: none; border-top: 1px solid var(--border); padding-top: 14px; }
.add-extras.show { display: block; }

.add-extras-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.extras-item {
    display: flex; align-items: center; gap: 6px; cursor: pointer;
    font-size: 14px; color: var(--text-light); padding: 6px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.extras-item:hover { border-color: var(--green); color: var(--green); }

.date-input {
    border: none; outline: none; font-family: inherit; font-size: 14px;
    color: var(--text); background: transparent; cursor: pointer;
}

.file-names {
    font-size: 12px; color: var(--text-light); flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.add-btn {
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white; border: none; padding: 8px 24px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
    white-space: nowrap; box-shadow: 0 2px 4px rgba(0,107,33,0.2);
}
.add-btn:hover { background: linear-gradient(135deg, #00541A, #006B21); transform: translateY(-1px); }

/* ==================== LOAD LIST ==================== */
.load-list { padding: 20px 36px; }

.load-item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 14px 18px; background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 8px;
    transition: all 0.15s;
}
.load-item:hover { box-shadow: var(--shadow); border-color: #CCC; transform: translateY(-1px); }
.load-item.starred { border-left: 3px solid var(--star-color); }
.load-item.completed { opacity: 0.6; }

.inline-form { display: inline; }

/* Check button */
.check-btn {
    background: none; border: none; cursor: pointer; padding: 2px;
    font-size: 22px; line-height: 1; color: var(--text-lighter);
    transition: color 0.15s; flex-shrink: 0; margin-top: 1px;
}
.check-btn:hover { color: var(--check-green); }
.check-circle.checked { color: var(--check-green); font-size: 20px; }

/* Load info */
.load-info { flex: 1; min-width: 0; cursor: default; }

.load-title { font-size: 15px; font-weight: 400; word-wrap: break-word; display: block; line-height: 1.4; }
.completed-title { text-decoration: line-through; color: var(--text-light); }

/* Date display — To Do style */
.load-date {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--green); margin-top: 4px; cursor: pointer;
    position: relative; font-weight: 500;
}
.load-date.overdue { color: var(--overdue); }
.load-date.no-date { display: none; }
.load-item:hover .load-date.no-date { display: inline-flex; }

.date-edit {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; font-size: 13px;
}

.completed-date { font-size: 12px; color: var(--text-lighter); display: block; margin-top: 2px; }

.edit-hint {
    display: none; font-size: 11px; color: var(--text-lighter);
    font-style: italic; margin-top: 3px;
}
.load-item:hover .edit-hint { display: block; }

/* Inline edit */
.edit-row {
    display: flex; flex-direction: column; gap: 8px; width: 100%;
}

.edit-input {
    width: 100%; border: 2px solid var(--green); border-radius: var(--radius-sm);
    padding: 8px 12px; font-size: 15px; font-family: inherit;
    color: var(--text); outline: none; background: var(--green-light);
}

.edit-date-input {
    width: auto; border: 2px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 12px; font-size: 14px; font-family: inherit;
    color: var(--text); outline: none; background: var(--white);
    cursor: pointer; transition: border-color 0.15s;
}
.edit-date-input:focus { border-color: var(--green); }

.edit-btn-row {
    display: flex; gap: 8px;
}

.edit-save-btn {
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white; border: none; padding: 6px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.edit-save-btn:hover { background: linear-gradient(135deg, #00541A, #006B21); }

.edit-cancel-btn {
    background: var(--sidebar-bg); color: var(--text-light); border: 1px solid var(--border);
    padding: 6px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.edit-cancel-btn:hover { background: var(--border); }

/* Attachments */
.load-attachments { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.attachment-link {
    font-size: 12px; color: var(--green); text-decoration: none;
    background: var(--green-light); padding: 2px 8px; border-radius: 4px;
    transition: background 0.15s;
}
.attachment-link:hover { background: var(--green-mid); }

/* Load actions */
.load-actions { display: flex; gap: 2px; flex-shrink: 0; align-items: center; margin-top: 1px; }

.attach-btn {
    cursor: pointer; font-size: 16px; color: var(--text-lighter);
    padding: 4px; opacity: 0; transition: all 0.15s; position: relative;
}
.load-item:hover .attach-btn { opacity: 1; }
.attach-btn:hover { color: var(--green); }
.attach-btn input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.star-btn {
    background: none; border: none; cursor: pointer; font-size: 22px;
    color: var(--text-lighter); padding: 4px; transition: color 0.15s;
}
.star-btn:hover, .star-btn.active { color: var(--star-color); }

.delete-btn {
    background: none; border: none; cursor: pointer; font-size: 18px;
    color: var(--text-lighter); padding: 4px; opacity: 0;
    transition: all 0.15s;
}
.load-item:hover .delete-btn { opacity: 1; }
.delete-btn:hover { color: var(--red); }
.delete-btn.always-show { opacity: 0.5; }

/* ==================== COMPLETED SECTION ==================== */
.completed-section {
    margin: 8px 36px 24px; background: var(--white);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 4px 18px 18px;
}

.completed-toggle {
    display: flex; align-items: center; gap: 10px; background: none;
    border: none; cursor: pointer; font-size: 14px; font-weight: 600;
    color: var(--text-light); padding: 12px 4px; font-family: inherit;
    transition: color 0.15s; width: 100%; text-align: left;
}
.completed-toggle:hover { color: var(--text); }

.toggle-arrow { font-size: 11px; transition: transform 0.2s; display: inline-block; }
.toggle-arrow.open { transform: rotate(90deg); }

.completed-count {
    background: var(--green-light); color: var(--green);
    font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}

.completed-body { display: none; }
.completed-body.show { display: block; }

.completed-search {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; background: var(--sidebar-bg);
    border-radius: var(--radius-sm); margin-bottom: 8px;
}
.search-icon { font-size: 14px; }
.search-input {
    flex: 1; border: none; outline: none; font-size: 14px;
    font-family: inherit; color: var(--text); background: transparent;
}
.search-input::placeholder { color: var(--text-lighter); }
.clear-search { color: var(--text-lighter); text-decoration: none; font-size: 16px; padding: 2px; }
.clear-search:hover { color: var(--text); }

.completed-list { padding: 0; }
.completed-list .load-item { margin-bottom: 4px; padding: 10px 14px; }

/* ==================== SIDEBAR HOURS NAV ==================== */
.nav-divider { height: 1px; background: var(--border); margin: 8px 22px; }
.nav-section-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--text-lighter); padding: 12px 22px 4px; margin-top: 4px;
}
.nav-sub { padding-left: 32px; }

/* ==================== DRIVER HOURS ==================== */
.hours-container { padding: 20px 36px; }

.hours-month {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 10px;
    overflow: hidden;
}
.hours-month.current-month { border-color: var(--green); border-width: 2px; }

.hours-month-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; cursor: pointer; user-select: none;
    transition: background 0.15s;
}
.hours-month-header:hover { background: var(--sidebar-bg); }

.month-label { font-size: 16px; font-weight: 600; flex: 1; }

.month-total-badge {
    background: var(--green-light); color: var(--green);
    font-size: 13px; font-weight: 700; padding: 3px 10px;
    border-radius: 12px;
}

.hours-month-body { display: none; padding: 0 18px 18px; }
.hours-month-body.show { display: block; }

.hours-notes {
    width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: 14px; font-family: 'Segoe UI', -apple-system, monospace;
    color: var(--text); resize: vertical; line-height: 1.6;
    transition: border-color 0.15s; background: var(--sidebar-bg);
}
.hours-notes:focus { border-color: var(--green); outline: none; background: var(--white); }
.hours-notes:disabled { opacity: 0.6; cursor: not-allowed; }

.hours-total-row {
    display: flex; align-items: center; gap: 12px; margin-top: 12px;
}
.hours-total-row label {
    font-size: 14px; font-weight: 600; color: var(--text-light);
}
.hours-total-input {
    width: 90px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 12px; font-size: 15px; font-family: inherit;
    color: var(--text); text-align: center; transition: border-color 0.15s;
}
.hours-total-input:focus { border-color: var(--green); outline: none; }
.hours-total-input:disabled { opacity: 0.6; cursor: not-allowed; }

.save-hours-btn {
    background: linear-gradient(135deg, #006B21, #1B8A3A);
    color: white; border: none; padding: 8px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.save-hours-btn:hover { background: linear-gradient(135deg, #00541A, #006B21); }
.save-hours-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.save-status { font-size: 13px; font-weight: 500; }
.save-status.saving { color: var(--text-lighter); }
.save-status.saved { color: var(--green); }
.save-status.error { color: var(--red); }

/* ==================== MAINTENANCE ==================== */
.maint-header { background: linear-gradient(135deg, #37474F, #546E7A); }
.maint-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.maint-meta { font-size: 12px; color: var(--text-lighter); display: block; margin-top: 3px; }

/* ==================== EMPTY STATE ==================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 17px; margin-bottom: 4px; }
.empty-hint { font-size: 14px; color: var(--text-lighter); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); box-shadow: none; }
    .sidebar-nav { display: flex; padding: 0; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .nav-item { padding: 10px 14px; margin: 0; border-radius: 0; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13px; }
    .nav-item.active { background: transparent; border-bottom-color: var(--green); }
    .nav-sub { padding-left: 14px; }
    .nav-divider { display: none; }
    .nav-section-label { display: none; }
    .nav-icon { font-size: 16px; width: 20px; }
    .tanker-svg { width: 20px; }
    .tanker-svg.tanker-lg { width: 22px; }
    .sidebar-header { padding: 8px 16px; }
    .sidebar-logo { height: 22px; margin-bottom: 0; }
    .sidebar-subtitle { display: none; }
    .sidebar-footer { display: none; }
    .list-header { padding: 20px 16px 16px; }
    .add-form { margin: -8px 16px 0; }
    .load-list { padding: 16px 16px; }
    .completed-section { margin: 8px 16px 16px; }
    .load-item .delete-btn, .load-item .attach-btn { opacity: 1; }
    .edit-hint { display: none !important; }
    .hours-container { padding: 16px 16px; }
    .hours-total-row { flex-wrap: wrap; }
}
