@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Syne:wght@700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --navy: #0d2b45;
    --navy-mid: #0f5280;
    --bg: #f2f5f8;
    --white: #fff;
    --text: #0d1b2a;
    --muted: #999;
    --border: #e8ecef;
}

html, body {
    height: 100%;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text);
}

/* ---- APP HEADER ---- */
.app-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
    padding: 14px 16px 12px;
    color: #fff;
    flex-shrink: 0;
}
.app-header-label { font-size: 10px; opacity: 0.6; letter-spacing: 2px; text-transform: uppercase; }
.app-header-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; margin-top: 2px; }
.app-header-meta { font-size: 10px; opacity: 0.55; margin-top: 3px; }

/* ---- TABS ---- */
.tabs {
    background: var(--white);
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tab {
    flex: 1;
    padding: 11px 0;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    color: var(--muted);
    border-bottom: 2.5px solid transparent;
    transition: all 0.25s;
    cursor: pointer;
    user-select: none;
}
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }

/* ---- CONTENT ---- */
.content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* ---- SCREENS ---- */
.screen {
    position: absolute;
    inset: 0;
    padding: 12px;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(28px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
    visibility: hidden;
}
.screen.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
}
.screen.exit {
    opacity: 0;
    transform: translateX(-28px);
}

/* ---- SKELETON ---- */
.skeleton {
    background: linear-gradient(90deg, #e8ecef 25%, #f5f7f9 50%, #e8ecef 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 10px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---- SUMMARY GRID ---- */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.summary-card {
    background: var(--white);
    border-radius: 11px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.s-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.s-count { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1; }
.s-label { font-size: 9px; color: var(--muted); margin-top: 2px; letter-spacing: 0.5px; }

/* ---- SECTION TITLE ---- */
.section-title {
    font-size: 9px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* ---- JOB CARDS ---- */
.job-card {
    background: var(--white);
    border-radius: 11px;
    padding: 11px 12px 10px;
    margin-bottom: 8px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.07);
    border-left: 3.5px solid #ddd;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.job-card:active { transform: scale(0.98); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.job-top { display: flex; justify-content: space-between; align-items: flex-start; }
.job-name { font-size: 13px; font-weight: 700; color: var(--text); }
.job-item { font-size: 11px; color: #555; margin-top: 2px; }
.job-issue { font-size: 10px; color: #aaa; margin-top: 2px; }
.badge {
    font-size: 9px; font-weight: 700;
    padding: 3px 8px; border-radius: 20px;
    white-space: nowrap; display: inline-block;
}
.job-date { font-size: 10px; color: #bbb; margin-top: 4px; text-align: right; }
.job-amount { font-size: 12px; font-weight: 700; color: var(--navy); margin-top: 6px; }

/* ---- DETAIL SCREEN ---- */
.detail-back {
    font-size: 12px; font-weight: 700;
    color: var(--navy); margin-bottom: 12px;
    cursor: pointer; display: inline-block;
    padding: 4px 0;
}
.detail-card {
    background: var(--white);
    border-radius: 13px;
    padding: 16px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.09);
}
.detail-id { font-size: 9px; color: #aaa; letter-spacing: 1.5px; margin-bottom: 4px; }
.detail-name { font-size: 18px; font-weight: 800; color: var(--text); }
.detail-item { font-size: 12px; color: #666; margin-top: 4px; }
.divider { height: 1px; background: #f0f0f0; margin: 13px 0; }
.detail-row { display: flex; justify-content: space-between; margin-bottom: 9px; align-items: center; }
.detail-key { font-size: 11px; color: #aaa; }
.detail-val { font-size: 12px; font-weight: 700; color: var(--text); text-align: right; max-width: 60%; }
.btn-row { display: flex; gap: 8px; margin-top: 14px; }
.btn-primary {
    flex: 1; padding: 11px 0;
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    color: #fff; border: none; border-radius: 10px;
    font-size: 11px; font-weight: 700; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: opacity 0.2s;
}
.btn-primary:active { opacity: 0.85; }
.btn-secondary {
    flex: 1; padding: 11px 0;
    background: #e8f4fd; color: var(--navy);
    border: none; border-radius: 10px;
    font-size: 11px; font-weight: 700; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}

/* ---- ADD JOB FORM ---- */
.form-group { margin-bottom: 11px; }
.form-label { font-size: 9px; color: var(--muted); font-weight: 700; letter-spacing: 1.2px; margin-bottom: 5px; }
.form-field {
    width: 100%;
    background: var(--white);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 13px;
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.25s, box-shadow 0.25s;
    -webkit-appearance: none;
    resize: none;
}
.form-field:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(13,43,69,0.08);
}
.btn-add {
    width: 100%; padding: 13px;
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    color: #fff; border: none; border-radius: 11px;
    font-size: 13px; font-weight: 700;
    margin-top: 6px; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    box-shadow: 0 4px 16px rgba(13,43,69,0.25);
    transition: opacity 0.2s, transform 0.15s;
}
.btn-add:active { opacity: 0.9; transform: scale(0.99); }
.btn-add:disabled { opacity: 0.6; }

/* ---- REPORT SCREEN ---- */
.date-row { display: flex; gap: 8px; margin-bottom: 12px; }
.date-box {
    flex: 1; background: var(--white);
    border-radius: 10px; padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.date-label { font-size: 9px; color: var(--muted); font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; }
.date-input {
    width: 100%; border: none; outline: none;
    font-size: 12px; color: var(--text);
    font-family: 'DM Sans', sans-serif;
    background: transparent;
}
.report-card {
    background: var(--white);
    border-radius: 13px;
    padding: 14px 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    margin-bottom: 12px;
}
.report-row {
    display: flex; justify-content: space-between;
    padding: 7px 0; border-bottom: 1px solid #f5f5f5;
    align-items: center;
}
.report-row:last-child { border-bottom: none; }
.report-key { font-size: 12px; color: #666; }
.report-val { font-size: 13px; font-weight: 800; color: var(--navy); }
.btn-pdf {
    width: 100%; padding: 13px;
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    color: #fff; border: none; border-radius: 11px;
    font-size: 13px; font-weight: 700; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    box-shadow: 0 4px 16px rgba(13,43,69,0.25);
    transition: opacity 0.2s;
}
.btn-pdf:active { opacity: 0.85; }

/* ---- TOAST ---- */
.toast {
    position: absolute; top: 10px; left: 10px; right: 10px;
    background: var(--navy);
    border: 1px solid #1a5280;
    color: #fff; font-size: 12px; font-weight: 600;
    padding: 10px 14px; border-radius: 11px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 100; opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---- BOTTOM BAR ---- */
.bottom-bar {
    background: #1a2e3d;
    padding: 8px 0 10px;
    text-align: center;
    font-size: 9px; color: #4a7a9b;
    letter-spacing: 1.8px; flex-shrink: 0;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--muted); font-size: 13px;
}
.empty-state-icon { font-size: 36px; margin-bottom: 10px; }

/* ---- SCROLLBAR ---- */
.screen::-webkit-scrollbar { width: 3px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ---- SUB TABS ---- */
.tabs-sub {
    display: flex;
    background: #f2f5f8;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 2px;
}
.tab-sub {
    flex: 1; padding: 8px 0;
    font-size: 11px; font-weight: 700;
    text-align: center; color: var(--muted);
    border-radius: 8px; cursor: pointer;
    transition: all 0.2s;
}
.tab-sub.active { background: var(--white); color: var(--navy); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ---- STATUS BADGES ---- */
.status-received   { background:#F8D7DA; color:#721C24; }
.status-ready      { background:#D1F0E0; color:#155724; }
.status-delivered  { background:#D6EAF8; color:#1A5276; }
.status-pending    { background:#FFF3CD; color:#856404; }
.status-repair     { background:#E8DAEF; color:#4A235A; }
.status-cancelled  { background:#F5F5F5; color:#666; }

/* ---- PENDING CARD DAYS ---- */
.days-badge {
    font-size: 9px; font-weight: 700;
    padding: 2px 7px; border-radius: 20px;
    background: #FFF3CD; color: #856404;
    margin-top: 4px; display: inline-block;
}
.days-badge.urgent { background: #F8D7DA; color: #721C24; }

/* ---- ACTION BUTTONS ---- */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}
.btn-action {
    padding: 10px 8px;
    border: none; border-radius: 10px;
    font-size: 11px; font-weight: 700;
    cursor: pointer; font-family: 'DM Sans', sans-serif;
    transition: opacity 0.2s;
}
.btn-action:active { opacity: 0.8; }
.btn-action.blue   { background: #D6EAF8; color: #1A5276; }
.btn-action.green  { background: #D1F0E0; color: #155724; }
.btn-action.red    { background: #F8D7DA; color: #721C24; }
.btn-action.orange { background: #FFF3CD; color: #856404; }
.btn-action.purple { background: #E8DAEF; color: #4A235A; }
.btn-action.navy   { background: #0d2b45; color: #fff; }

/* ---- AUTOCOMPLETE ---- */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e8ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
    max-height: 180px;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 10px 13px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:active, .autocomplete-item:hover { background: #f2f5f8; }
.autocomplete-name { font-weight: 700; color: #0d1b2a; }
.autocomplete-phone { font-size: 11px; color: #999; margin-top: 1px; }

/* ---- NOTES EDITOR ---- */
.notes-editor {
    background: #FFFDE7;
    border: 1.5px solid #FFC107;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
}
.notes-editor textarea {
    width: 100%; border: none; background: transparent;
    font-size: 12px; font-family: 'DM Sans', sans-serif;
    color: #0d1b2a; resize: none; outline: none;
    min-height: 60px;
}
.notes-save-btn {
    background: #FFC107; color: #0d1b2a;
    border: none; border-radius: 8px;
    padding: 6px 14px; font-size: 11px;
    font-weight: 700; cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    margin-top: 6px;
}
