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

:root {
    --bg-app: #f4f4f5;
    --bg-card: #ffffff;
    --bg-header: #f4f4f5;
    --bg-footer: #ffffff;

    --text-main: #18181b;
    --text-sub: #71717a;

    /* Tone-on-Tone Palettes */
    --color-sage-bg: #ecfccb;
    --color-sage-border: #84cc16;
    --color-sage-text: #365314;
    --color-sage-sub: #4d7c0f;

    --color-clay-bg: #ffe4e6;
    --color-clay-border: #fda4af;
    --color-clay-text: #881337;
    --color-clay-sub: #be123c;
    --color-clay-btn-bg: #fff1f2;

    --color-success: #4a5d23;
    --color-success-bg: #f7fee7;

    --color-error: #dc2626;
    --color-accent: #eab308;
    --color-slate-btn: #475569;

    --border-subtle: #e4e4e7;
    --border-frame: #ffffff;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --text-footer-active: #18181b;
    --text-footer-dim: #a1a1aa;
}

.dark {
    --bg-app: #09090b;
    --bg-card: #18181b;
    --bg-header: #09090b;
    --bg-footer: #18181b;

    --text-main: #fafafa;
    --text-sub: #a1a1aa;

    --color-sage-bg: #1a2e05;
    --color-sage-border: #365314;
    --color-sage-text: #ecfccb;
    --color-sage-sub: #bef264;

    --color-clay-bg: #4c0519;
    --color-clay-border: #881337;
    --color-clay-text: #ffe4e6;
    --color-clay-sub: #fda4af;
    --color-clay-btn-bg: #4c0519;

    --color-success: #65a30d;
    --color-success-bg: #1a2e05;

    --border-subtle: #27272a;
    --border-frame: #18181b;

    --text-footer-active: #ffffff;
    --text-footer-dim: #52525b;
    --color-slate-btn: #94a3b8;
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; background: var(--bg-header); }
body { background: var(--bg-header); font-family: 'Inter', sans-serif; display: flex; flex-direction: column; min-height: 100vh; overscroll-behavior: none; }

/* HIDE GOOGLE MAPS CLUTTER */
.gmnoprint, .gm-style-cc, .gm-bundled-control, a[href^="https://maps.google.com/maps"], a[href^="https://www.google.com/maps"] { display: none !important; }
.gm-style-pbc { opacity: 0 !important; }

#app-wrapper { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; position: fixed; top: 0; left: 0; right: 0; bottom: 0; }
#frame-arch { flex: 1; min-height: 0; display: flex; flex-direction: column; background-color: var(--bg-app); overflow: hidden; position: relative; z-index: 10; border: 12px solid var(--border-frame); border-bottom: none; border-radius: 46px 46px 0 0; }

#app-footer { position: fixed; bottom: 0; left: 0; right: 0; height: 68px; padding: 10px 0 0; background-color: var(--bg-footer); display: flex; align-items: flex-start; justify-content: space-around; z-index: 999; border-top: 1px solid var(--border-subtle); }
.footer-btn { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; width: 60px; height: auto; padding: 0; flex-shrink: 0; }

@media (min-width: 500px) {
    body { justify-content: center; align-items: center; background: #111 !important; }
    #app-wrapper { width: 390px; height: 844px; border-radius: 50px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7); background: var(--bg-footer); position: relative; }
    #frame-arch { border: 14px solid var(--border-frame); border-bottom: none; border-radius: 46px 46px 0 0; }
    #app-footer { }
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
#app-header { flex-shrink: 0; height: 90px; padding-top: max(40px, env(safe-area-inset-top, 40px)); padding-bottom: 8px; padding-left: 20px; padding-right: 20px; background-color: var(--bg-header); display: flex; align-items: center; justify-content: space-between; z-index: 20; }
#app-scroll-area { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; background-color: var(--bg-app); position: relative; display: flex; flex-direction: column; min-height: 0; -webkit-overflow-scrolling: touch; padding-bottom: 68px; overscroll-behavior: none; }

/* HERO VIEW */
#hero-view { display: flex; flex-direction: column; height: 100%; width: 100%; background: var(--bg-app); overflow: hidden; }
#hero-map-area { flex: 1; min-height: 0; width: calc(100% - 32px); margin: 16px 16px 0 16px; position: relative; background: var(--bg-app); border-radius: 24px; overflow: hidden; }
#hero-controls { flex-shrink: 0; padding: 16px 20px; background: var(--bg-app); width: 100%; }
.controls-disabled { opacity: 0.3; pointer-events: none; filter: grayscale(1); }
.pano-crop-container { width: 100%; height: 100%; overflow: hidden; position: relative; background-color: var(--bg-app); }
.pano-zoom-wrapper { width: 100%; height: 100%; }
.info-float-card { background: #ffffff !important; border: 1px solid rgba(0,0,0,0.05); border-radius: 16px; padding: 12px 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
.dark .info-float-card { background: #18181b !important; border-color: #27272a; }

/* JOB CARDS */
.job-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 20px; padding: 20px; margin-bottom: 12px; transition: all 0.2s ease; position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; }
.job-card.active-next { border-color: var(--color-success); background: var(--color-success-bg); box-shadow: 0 0 0 1px var(--color-success); }
.job-card.completed { background-color: var(--color-sage-bg); border-color: var(--color-sage-border); }
.job-card.completed * { color: var(--color-sage-text) !important; }
.job-card.completed .sub-text { color: var(--color-sage-sub) !important; opacity: 1 !important; }
.job-card.completed .icon-circle { background-color: var(--color-sage-sub) !important; }
.job-card.completed .icon-svg { color: var(--color-sage-bg) !important; }
.job-card.unable { background-color: var(--color-clay-bg); border-color: var(--color-clay-border); }
.job-card.unable * { color: var(--color-clay-text) !important; }
.job-card.unable .sub-text { color: var(--color-clay-sub) !important; opacity: 1 !important; }
.job-card.unable .icon-circle { background-color: var(--color-clay-sub) !important; }
.job-card.unable .icon-circle * { color: #ffffff !important; }
.job-card.locked { opacity: 0.5; filter: grayscale(1); }

.card-seq { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-sub); margin-bottom: 2px; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.card-addr { font-size: 0.85rem; font-weight: 500; color: var(--text-sub); margin-top: 2px; }
.sub-text { transition: color 0.2s; }

/* ROUTE LINE */
.route-list-container { position: relative; padding-left: 24px; }
.route-line-track { position: absolute; left: 8px; top: 24px; bottom: 24px; width: 2px; background-color: var(--border-subtle); z-index: 0; }
.route-line-fill { position: absolute; left: 8px; top: 24px; width: 2px; background-color: var(--color-success); z-index: 1; transition: height 0.5s ease; }

.btn-press:active { transform: scale(0.96); opacity: 0.9; }
.btn-shadow { box-shadow: var(--shadow-soft); }

/* CONTROLS */
.dynamic-row-2 { display: flex; gap: 0; height: 64px; margin-bottom: 12px; width: 100%; position: relative; }
.btn-cancel-dynamic { overflow: hidden; white-space: nowrap; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: translateZ(0); transition: flex-grow 0.6s cubic-bezier(0.2, 0.9, 0.1, 1), opacity 0.4s ease 0.1s, margin-right 0.6s cubic-bezier(0.2, 0.9, 0.1, 1); }
.btn-main-dynamic { transform: translateZ(0); transition: flex-grow 0.6s cubic-bezier(0.2, 0.9, 0.1, 1), background-color 0.2s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.state-start .btn-cancel-dynamic { flex-grow: 0; width: 0; opacity: 0; margin-right: 0; border-width: 0; padding: 0; }
.state-start .btn-main-dynamic { flex-grow: 1; width: 100%; }
.state-active .btn-cancel-dynamic { flex-grow: 1; opacity: 1; margin-right: 12px; border-width: 1px; }
.state-active .btn-main-dynamic { flex-grow: 2.1; }

.theme-switch { width: 44px; height: 24px; background: #e5e5e5; border-radius: 99px; position: relative; cursor: pointer; }
.dark .theme-switch { background: #333; }
.theme-knob { width: 20px; height: 20px; background: white; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.dark .theme-knob { transform: translateX(20px); }

/* MODAL */
#modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 1000; overscroll-behavior: none; }
#modal-content { background: var(--bg-card); width: 90%; max-width: 500px; max-height: 80vh; border-radius: 24px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; overscroll-behavior: none; -webkit-overflow-scrolling: auto; }
.modal-body-compact { padding: 12px 16px; }
.modal-footer { padding: 16px; border-top: 1px solid var(--border-subtle); background: var(--bg-header); display: flex; justify-content: flex-end; gap: 8px; }

/* TIMELINE — Serpentine */
.tl-serpentine { position: relative; padding: 0 30px; overflow: visible; }
.tl-serpentine-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 0; }
.tl-serpentine-svg path { fill: none; stroke-width: 3; stroke-linecap: round; }

/* Card row: icon block + card body */
.tl-entry { display: flex; align-items: stretch; width: 100%; border-radius: 16px; overflow: hidden; background: var(--bg-card); box-shadow: var(--shadow-soft); position: relative; z-index: 2; margin-bottom: 16px; }
.dark .tl-entry { background: #27272a; }
.tl-entry:last-child { margin-bottom: 0; }
.tl-entry.tl-right { flex-direction: row-reverse; }

/* Colored icon block */
.tl-icon-block { width: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-right: 2px solid transparent; }
.tl-right .tl-icon-block { border-right: none; border-left: 2px solid transparent; }
.tl-icon-block svg, .tl-icon-block i { width: 22px; height: 22px; }

/* Card body */
.tl-card-body { flex: 1; padding: 12px 14px; }
.tl-entry.tl-right .tl-card-body { text-align: right; }
.tl-badge { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.tl-title { font-size: 0.85rem; font-weight: 500; color: var(--text-sub); line-height: 1.35; }
.tl-time { font-size: 0.7rem; font-weight: 600; color: var(--text-sub); margin-top: 2px; opacity: 0.7; }
.tl-notes-box { background: rgba(0,0,0,0.04); border-radius: 10px; padding: 8px 10px; font-size: 0.75rem; color: var(--text-main); margin-top: 5px; text-align: left; }
.dark .tl-notes-box { background: rgba(255,255,255,0.06); }
.tl-notes-label { font-size: 0.55rem; font-weight: 700; text-transform: uppercase; opacity: 0.6; display: block; margin-bottom: 2px; }

/* Color variants — tone-on-tone icon block + badge + stroke */
.tl-entry.clock-in .tl-icon-block { background: #f5f3ff; border-color: #c4b5fd; }
.tl-entry.clock-in .tl-icon-block svg, .tl-icon-block i { color: #a78bfa; }
.tl-entry.clock-in .tl-badge { color: #7c3aed; }
.dark .tl-entry.clock-in .tl-icon-block { background: #4c1d95; border-color: #a78bfa; }
.dark .tl-entry.clock-in .tl-icon-block svg, .tl-icon-block i { color: #a78bfa; }
.dark .tl-entry.clock-in .tl-badge { color: #a78bfa; }

.tl-entry.travel .tl-icon-block { background: #f8fafc; border-color: #cbd5e1; }
.tl-entry.travel .tl-icon-block svg, .tl-icon-block i { color: #94a3b8; }
.tl-entry.travel .tl-badge { color: #64748b; }
.dark .tl-entry.travel .tl-icon-block { background: #334155; border-color: #94a3b8; }
.dark .tl-entry.travel .tl-icon-block svg, .tl-icon-block i { color: #94a3b8; }
.dark .tl-entry.travel .tl-badge { color: #94a3b8; }

.tl-entry.completed .tl-icon-block { background: #f7fee7; border-color: #bef264; }
.tl-entry.completed .tl-icon-block svg, .tl-icon-block i { color: #a3e635; }
.tl-entry.completed .tl-badge { color: var(--color-sage-text); }
.dark .tl-entry.completed .tl-icon-block { background: #365314; border-color: #a3e635; }
.dark .tl-entry.completed .tl-icon-block svg, .tl-icon-block i { color: #a3e635; }
.dark .tl-entry.completed .tl-badge { color: #a3e635; }

.tl-entry.unable .tl-icon-block { background: #fff1f2; border-color: #fda4af; }
.tl-entry.unable .tl-icon-block svg, .tl-icon-block i { color: #fb7185; }
.tl-entry.unable .tl-badge { color: #e11d48; }
.dark .tl-entry.unable .tl-icon-block { background: #9f1239; border-color: #fb7185; }
.dark .tl-entry.unable .tl-icon-block svg, .tl-icon-block i { color: #fb7185; }
.dark .tl-entry.unable .tl-badge { color: #fb7185; }

.tl-entry.lunch .tl-icon-block { background: #eff6ff; border-color: #93c5fd; }
.tl-entry.lunch .tl-icon-block svg, .tl-icon-block i { color: #60a5fa; }
.tl-entry.lunch .tl-badge { color: #2563eb; }
.dark .tl-entry.lunch .tl-icon-block { background: #1e40af; border-color: #60a5fa; }
.dark .tl-entry.lunch .tl-icon-block svg, .tl-icon-block i { color: #60a5fa; }
.dark .tl-entry.lunch .tl-badge { color: #60a5fa; }

.tl-entry.gas .tl-icon-block { background: #fffbeb; border-color: #fcd34d; }
.tl-entry.gas .tl-icon-block svg, .tl-icon-block i { color: #fbbf24; }
.tl-entry.gas .tl-badge { color: #d97706; }
.dark .tl-entry.gas .tl-icon-block { background: #92400e; border-color: #fbbf24; }
.dark .tl-entry.gas .tl-icon-block svg, .tl-icon-block i { color: #fbbf24; }
.dark .tl-entry.gas .tl-badge { color: #fbbf24; }

.tl-entry.text .tl-icon-block { background: #ecfeff; border-color: #67e8f9; }
.tl-entry.text .tl-icon-block svg, .tl-icon-block i { color: #22d3ee; }
.tl-entry.text .tl-badge { color: #0891b2; }
.dark .tl-entry.text .tl-icon-block { background: #155e75; border-color: #22d3ee; }
.dark .tl-entry.text .tl-icon-block svg, .tl-icon-block i { color: #22d3ee; }
.dark .tl-entry.text .tl-badge { color: #22d3ee; }

/* SVG pipe connector stroke colors (match NEXT card type) */
.stroke-clock-in { stroke: #7c3aed; } .dark .stroke-clock-in { stroke: #a78bfa; }
.stroke-travel { stroke: #64748b; } .dark .stroke-travel { stroke: #94a3b8; }
.stroke-completed { stroke: var(--color-sage-border); } .dark .stroke-completed { stroke: #a3e635; }
.stroke-unable { stroke: #e11d48; } .dark .stroke-unable { stroke: #fb7185; }
.stroke-lunch { stroke: #2563eb; } .dark .stroke-lunch { stroke: #60a5fa; }
.stroke-gas { stroke: #d97706; } .dark .stroke-gas { stroke: #fbbf24; }
.stroke-text { stroke: #0891b2; } .dark .stroke-text { stroke: #22d3ee; }

/* GAS / LIST INPUTS */
.list-input-row { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-card); }
.list-input-row:last-child { border-bottom: none; }
.list-input-label { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.list-input-field { text-align: right; background: transparent; border: none; font-size: 1rem; color: var(--text-main); width: 120px; outline: none; }

/* TICK CARDS */
.tick-card { display: flex; flex-direction: column; background: var(--bg-header); border-radius: 16px; overflow: hidden; border: 1px solid var(--border-subtle); margin-bottom: 12px; }
.tick-img { width: 100%; height: 200px; object-fit: cover; background: var(--bg-card); }
.tick-content { padding: 16px; }

/* PRODUCT LABEL */
.warning-box { background: #fefce8; border: 1px solid #fde047; padding: 16px; border-radius: 12px; margin-bottom: 16px; }
.warning-title { color: #854d0e; font-weight: 800; font-size: 0.75rem; letter-spacing: 0.05em; margin-bottom: 4px; }
.label-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.label-table td { padding: 8px 0; border-bottom: 1px solid var(--border-subtle); vertical-align: top; color: var(--text-main); }
.label-table td:first-child { font-weight: 600; color: var(--text-sub); width: 40%; padding-right: 12px; }
.legal-text { font-size: 0.7rem; color: var(--text-sub); line-height: 1.5; margin-top: 8px; }

/* LICENSE CARD */
.card-flip-container { width: 100%; cursor: pointer; margin-bottom: 8px; background: none; border: none; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; -webkit-appearance: none; display: block; }
.card-flip-wrap { width: 100%; border-radius: 20px; overflow: hidden; -webkit-mask-image: -webkit-radial-gradient(white, black); -webkit-transition: -webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); -webkit-transform: scaleX(1); transform: scaleX(1); }
.card-flip-wrap.flip-out { -webkit-transform: scaleX(0.01); transform: scaleX(0.01); }
.card-flip-wrap img { width: 100%; display: block; pointer-events: none; border-radius: 20px; }

/* HELP BUTTON */
.help-btn-stroke { border: 1px solid var(--color-accent) !important; }

/* LUNCH GRAPHIC */
#lunch-graphic { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sub); gap: 16px; }
#lunch-graphic i { width: 64px; height: 64px; color: var(--color-slate-btn); opacity: 0.5; }
#lunch-graphic span { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }

/* CONDENSED INPUTS (Flowmeter) */
.condensed-input-group { margin-bottom: 8px; }
.condensed-input-group label { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-sub); margin-bottom: 4px; margin-left: 4px; }
.condensed-input-group input, .condensed-input-group select { padding: 12px; font-size: 1rem; outline: none; }
.condensed-input-group input:focus, .condensed-input-group select:focus { border-color: var(--color-success); }
