/* Trelane Logistics — Driver app prototype (snyx showcase; reconstructed from client work, synthetic data).
   Self-contained: stage, phone chrome, screens, mobile design system panel. */

:root {
  --navy-900: #1d2b3a;      /* primary bar, Start shift */
  --navy-800: #26374b;
  --navy-700: #34495f;
  --teal:     #12769a;      /* primary action bar on a work order */
  --teal-2:   #1690bd;
  --green:    #3c8c5c;
  --amber:    #c98a12;
  --amber-bg: #fdf7e6;
  --red:      #bf4436;
  --red-bg:   #fdf0ee;

  --paper: #ffffff;
  --ground: #eef1f4;
  --line: #dde3ea;
  --line-2: #eef1f5;
  --ink: #16202b;
  --ink-2: #45556a;
  --muted: #7b8798;

  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --fs-xs: 11px; --fs-sm: 12.5px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 21px;

  --radius: 6px;
  --shadow-1: 0 1px 2px rgba(22, 32, 43, .08);
  --shadow-2: 0 18px 50px rgba(22, 32, 43, .3);
  --focus: 0 0 0 3px rgba(18, 118, 154, .3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: var(--fs-md); color: var(--ink);
       background: radial-gradient(circle at 24% 12%, #f6f8fa, #e4e9ee 62%); min-height: 100vh;
       -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ stage */
.stage { display: flex; gap: 40px; align-items: flex-start; padding: 34px 32px 56px; max-width: 1180px; margin: 0 auto; }
.map-rail { width: 320px; flex: none; position: sticky; top: 34px; }
.map-rail h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
.map-rail h1 span { display: block; font-size: var(--fs-sm); font-weight: 400; color: var(--muted); margin-top: 3px;
                    letter-spacing: 0; }
.rail-note { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.6; margin: 14px 0 18px; }
.rail-foot { color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; margin-top: 18px; }

.flow { display: flex; flex-direction: column; gap: 14px; }
.flow-group h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
                 margin-bottom: 6px; }
.flow-btn { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none;
            border: 0; border-left: 2px solid var(--line); padding: 5px 0 5px 11px; cursor: pointer;
            font-size: var(--fs-sm); color: var(--ink-2); }
.flow-btn:hover { color: var(--ink); border-left-color: var(--muted); }
.flow-btn.is-on { color: var(--teal); font-weight: 600; border-left-color: var(--teal); }
.flow-btn .lock { margin-left: auto; color: var(--muted); }
.flow-btn .lock .ic { width: 13px; height: 13px; }
.ds-toggle { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 20px; padding: 10px 12px;
             border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer;
             font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.ds-toggle:hover { border-color: var(--teal); color: var(--teal); }
.ds-toggle .ic { margin-left: auto; width: 15px; height: 15px; }

/* ------------------------------------------------------------ phone */
.phone-wrap { flex: none; }
.phone { width: 390px; height: 780px; background: var(--paper); border-radius: 34px; box-shadow: var(--shadow-2);
         border: 9px solid #101820; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.status-bar { flex: none; height: 30px; display: flex; align-items: center; justify-content: space-between;
              padding: 0 20px; font-size: var(--fs-xs); font-weight: 600; background: var(--paper); }
.status-icons { display: flex; gap: 4px; }
.status-icons i { width: 12px; height: 9px; background: var(--ink); border-radius: 1px; display: block; }
.status-icons i:nth-child(2) { width: 11px; border-radius: 50% 50% 2px 2px; }
.status-icons i:nth-child(3) { width: 18px; border-radius: 2px; }
.screen { flex: 1; min-height: 0; overflow-y: auto; background: var(--ground); }
.phone-hint { width: 390px; margin-top: 14px; font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.6;
              text-align: center; min-height: 40px; }

/* app bar inside the screen */
.appbar { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line);
          display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.appbar .back { background: none; border: 0; cursor: pointer; color: var(--teal); display: flex; align-items: center;
                gap: 3px; font-size: var(--fs-sm); padding: 0; }
.appbar h2 { font-size: var(--fs-md); font-weight: 700; margin: 0 auto; }
.appbar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.appbar .spacer { width: 44px; }

.pad { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

/* driver header (home) */
.driver { background: var(--paper); padding: 16px 16px 18px; display: flex; align-items: center; gap: 13px;
          border-bottom: 1px solid var(--line); }
.driver-logo { width: 42px; height: 42px; border-radius: 9px; background: linear-gradient(140deg, #5fbf8a, #1d7fa0);
               flex: none; }
.driver b { display: block; font-size: var(--fs-xl); font-weight: 700; line-height: 1.15; }
.driver span { color: var(--muted); font-size: var(--fs-sm); }

/* big action tiles */
.tile { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 15px 14px; cursor: pointer; text-align: left; width: 100%; }
.tile:hover { border-color: var(--navy-700); }
.tile.primary { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.tile.primary:hover { background: var(--navy-800); }
.tile.primary .tile-ic { background: rgba(255,255,255,.14); color: #fff; }
.tile-ic { width: 38px; height: 38px; border-radius: 8px; background: var(--ground); display: grid; place-items: center;
           flex: none; color: var(--navy-900); }
.tile-ic .ic { width: 21px; height: 21px; }
.tile b { display: block; font-size: var(--fs-lg); font-weight: 700; line-height: 1.2; }
.tile span { font-size: var(--fs-sm); opacity: .7; }
.tile .go { margin-left: auto; opacity: .5; }
.tile:disabled { opacity: .5; cursor: not-allowed; }

/* generic card + rows */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-hd { padding: 11px 13px; border-bottom: 1px solid var(--line-2); font-weight: 700; font-size: var(--fs-sm); }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px 13px; font-size: var(--fs-sm); }
.kvs b { font-weight: 700; }
.kvs span { color: var(--ink-2); }
.kvs .r { text-align: right; }

.row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: var(--paper);
       border: 0; border-bottom: 1px solid var(--line-2); padding: 12px 13px; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #f7f9fb; }
.row.bar-red { border-left: 4px solid var(--red); }
.row.bar-green { border-left: 4px solid var(--green); }
.row.bar-amber { border-left: 4px solid var(--amber); }
.row-main { flex: 1; min-width: 0; }
.row-main span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.row-main b { display: block; font-size: var(--fs-md); font-weight: 700; line-height: 1.3; }
.row-main p { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.45; }
.row .go { color: var(--muted); }
.row .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid;
             place-items: center; color: #fff; flex: none; }
.row .tick .ic { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.row.is-done .tick { background: var(--green); border-color: var(--green); }
.row.is-done .tick .ic { opacity: 1; }
.row.is-done .row-main b { color: var(--muted); text-decoration: line-through; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px;
       border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; font-weight: 700; }
.btn.teal { background: var(--teal); color: #fff; }
.btn.teal:hover { background: var(--teal-2); }
.btn.navy { background: var(--navy-900); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.link { background: none; color: var(--teal); height: 38px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.actionbar { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--teal); color: #fff;
             border: 0; padding: 13px 14px; cursor: pointer; font-weight: 700; font-size: var(--fs-md); }
.actionbar:hover { background: var(--teal-2); }
.actionbar .go { margin-left: auto; }
.actionbar.is-done { background: var(--green); }

.note { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; padding: 12px 13px; background: var(--paper);
        display: flex; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.note .ic { color: var(--muted); }
.safety { background: var(--amber-bg); border: 1px solid #ecd9a4; border-radius: var(--radius); padding: 12px 13px;
          font-size: var(--fs-sm); line-height: 1.5; }
.safety b { display: block; margin-bottom: 3px; }

/* map snapshot */
.minimap { position: relative; height: 168px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.minimap svg { width: 100%; height: 100%; display: block; }
.minimap .fab { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
                display: grid; place-items: center; box-shadow: var(--shadow-1); }
.minimap .fab.nav { left: 10px; top: 10px; background: var(--navy-900); color: #fff; }
.minimap .fab.done { right: 10px; top: 10px; background: #fff; color: var(--green); border: 1px solid var(--line); }

/* checklist severity */
.sev { font-size: var(--fs-xs); color: var(--muted); }
.sev.high { color: var(--red); font-weight: 700; }
.sev.medium { color: var(--amber); font-weight: 700; }

/* keypad */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); }
.keypad button { height: 58px; background: var(--paper); border: 0; font-size: 21px; cursor: pointer; }
.keypad button:hover { background: #f2f5f8; }
.keypad button.alt { font-size: var(--fs-md); font-weight: 700; color: var(--teal); }
.readout { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
           text-align: center; }
.readout b { display: block; font-size: 32px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.readout span { font-size: var(--fs-sm); color: var(--muted); }

/* segmented */
.seg { display: flex; background: var(--paper); border-bottom: 1px solid var(--line); }
.seg button { flex: 1; background: none; border: 0; padding: 11px 6px; cursor: pointer; font-size: var(--fs-sm);
              color: var(--muted); border-bottom: 3px solid transparent; }
.seg button.is-on { color: var(--teal); font-weight: 700; border-bottom-color: var(--teal); }

/* progress */
.prog { height: 5px; background: var(--line-2); }
.prog i { display: block; height: 100%; background: var(--green); transition: width .4s ease; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 6px 12px; font-size: var(--fs-sm);
        cursor: pointer; color: var(--ink-2); }
.chip.is-on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
textarea { width: 100%; min-height: 86px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
           resize: vertical; font-size: var(--fs-sm); }
textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }

/* signature */
.sigpad { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); position: relative; }
.sigpad canvas { display: block; width: 100%; height: 130px; touch-action: none; cursor: crosshair; }
.sigpad .hintline { position: absolute; left: 14px; right: 14px; bottom: 26px; border-bottom: 1px solid var(--line); }
.sigpad .placeholder { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: var(--fs-xs);
                       color: var(--muted); }

/* tab bar */
.tabbar { flex: none; display: flex; background: var(--paper); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; background: none; border: 0; padding: 8px 2px 10px; cursor: pointer; color: var(--muted);
                 display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; }
.tabbar button.is-on { color: var(--teal); }
.tabbar button .ic { width: 20px; height: 20px; }

/* drawer + sheet inside the phone */
.drawer { position: absolute; inset: 0; z-index: 20; display: flex; }
.drawer-scrim { flex: 1; background: rgba(22,32,43,.45); }
.drawer-panel { width: 300px; background: #fff; display: flex; flex-direction: column; box-shadow: var(--shadow-2); }
.drawer-panel header { padding: 16px 16px 12px; }
.drawer-panel header b { display: block; font-size: var(--fs-xl); font-weight: 700; margin-top: 8px; }
.drawer-panel nav { flex: 1; overflow-y: auto; }
.dsec { padding: 12px 16px 6px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ditem { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 11px 16px;
         cursor: pointer; text-align: left; font-size: var(--fs-md); }
.ditem:hover { background: var(--ground); }
.ditem.is-on { background: var(--navy-900); color: #fff; }
.drawer-panel footer { border-top: 1px solid var(--line); display: flex; }
.drawer-panel footer button { flex: 1; background: none; border: 0; padding: 12px 6px; cursor: pointer;
                              display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: var(--fs-xs); }
.sync { padding: 8px 16px 14px; font-size: var(--fs-xs); color: var(--muted); }

.sheet { position: absolute; inset: 0; z-index: 25; background: rgba(22,32,43,.45); display: flex; align-items: flex-end; }
.sheet-panel { width: 100%; background: #fff; border-radius: 14px 14px 0 0; padding: 18px 16px 20px;
               display: flex; flex-direction: column; gap: 12px; }
.sheet-panel h3 { font-size: var(--fs-lg); font-weight: 700; }
.sheet-panel p { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }

/* ------------------------------------------------------------ design system panel */
.ds-panel { position: fixed; inset: 0; z-index: 60; background: rgba(22,32,43,.5); display: grid; place-items: center;
            padding: 24px; }
.ds-inner { background: #fff; border-radius: 12px; box-shadow: var(--shadow-2); width: 860px; max-width: 100%;
            max-height: 86vh; overflow: auto; }
.ds-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 10px; }
.ds-head h2 { font-size: var(--fs-xl); font-weight: 700; }
.ds-head button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); }
.ds-body { padding: 0 22px 24px; }
.ds-body p.lead { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.6; margin-bottom: 18px; max-width: 64ch; }
.ds-sec { border-top: 1px solid var(--line-2); padding: 16px 0; }
.ds-sec h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.ds-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.swatch { width: 96px; }
.swatch i { display: block; height: 46px; border-radius: 5px; border: 1px solid rgba(0,0,0,.08); }
.swatch b { display: block; font-size: var(--fs-xs); font-weight: 700; margin-top: 5px; }
.swatch span { font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace; }
.spec { display: flex; align-items: baseline; gap: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.spec b { width: 120px; flex: none; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 90; display: flex;
          flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy-900); color: #fff; padding: 10px 15px; border-radius: 20px; font-size: var(--fs-sm);
         box-shadow: var(--shadow-2); max-width: 420px; text-align: center; animation: toast-in .16s ease-out; }
.toast.is-out { opacity: 0; transform: translateY(6px); transition: .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .stage { flex-direction: column; align-items: center; gap: 26px; padding: 20px 16px 40px; }
  .map-rail { position: static; width: 100%; max-width: 420px; }
  .phone { width: 100%; max-width: 390px; }
  .phone-hint { width: 100%; max-width: 390px; }
}
