/* Technician pages. Phone first; shares its tokens with public/css/admin.css. */
:root{
  --bg:#F4F6F9;--surface:#FFFFFF;--border:#E1E6EE;--divider:#EEF1F5;--input:#D5DBE5;
  --text:#172033;--muted:#5B6576;
  --side:#14223A;--accent:#2F5FA8;--accent-dark:#1E3F73;--accent-soft:#E7EEF8;
  --ok-bg:#F0FAF4;--ok-border:#BFE3CE;--ok:#145C38;
  --no-bg:#FDF4F0;--no-border:#F0CDBE;--no:#8C2F0E;
  --pend-bg:#FDF0DC;--pend:#7A4A00;
  --tabbar:64px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:'Plus Jakarta Sans',system-ui,-apple-system,'Segoe UI',sans-serif;font-size:15px;line-height:1.4;font-variant-numeric:tabular-nums;-webkit-tap-highlight-color:transparent}
a{color:var(--accent)}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid #7FA6E0;outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
[hidden]{display:none!important}
h1{margin:0;font-size:26px;font-weight:700;letter-spacing:-.01em}
h2{margin:0;font-size:17px;font-weight:700}
p{margin:0}
.muted{color:var(--muted)}

/* Shell */
.topbar{background:var(--side);color:#fff;padding:calc(10px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 10px max(16px,env(safe-area-inset-left,0px))}
.brand{display:inline-flex;align-items:center;gap:10px;color:#fff;text-decoration:none;min-height:36px}
.brand-mark{width:32px;height:32px;border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;flex:none;overflow:hidden}
.brand-mark img{width:92%;height:92%}
.brand-mark.large{width:56px;height:56px;border-radius:14px}
.brand-name{font-weight:700;font-size:15px}
.main{width:100%;max-width:880px;margin:0 auto;padding:20px max(16px,env(safe-area-inset-right,0px)) calc(var(--tabbar) + 28px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));display:flex;flex-direction:column;gap:16px}
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;display:flex;background:var(--surface);border-top:1px solid var(--border);padding:0 env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
.tabbar a{flex:1;height:var(--tabbar);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:var(--muted);text-decoration:none;font-size:12px;font-weight:600}
.tabbar svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.tabbar a[aria-current="page"]{color:var(--accent)}

/* Buttons */
.btn{min-height:48px;padding:0 18px;border-radius:12px;border:1px solid transparent;font-size:15px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;text-decoration:none;background:none}
.btn-block{width:100%}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:active{background:var(--accent-dark)}
.btn-outline{background:var(--surface);border-color:var(--input);color:var(--text)}
.btn-danger{background:var(--no-bg);border-color:var(--no-border);color:var(--no)}
.btn[disabled]{opacity:.6;cursor:default}

/* Messages */
.flash{padding:12px 14px;border-radius:12px;font-weight:600}
.flash.ok{background:var(--ok-bg);border:1px solid var(--ok-border);color:var(--ok)}
.flash.err{background:var(--no-bg);border:1px solid var(--no-border);color:var(--no)}
.flash-link{display:block;text-decoration:none}
.empty{background:var(--surface);border:1px dashed var(--input);border-radius:14px;padding:28px 20px;text-align:center;color:var(--muted)}
.empty strong{display:block;color:var(--text);font-size:16px;margin-bottom:4px}

/* Home */
.stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.stat{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:6px;justify-content:space-between}
.stat-label{font-size:13px;font-weight:600;color:var(--muted)}
.stat-value{font-size:22px;font-weight:700;letter-spacing:-.02em;overflow-wrap:anywhere}
.section-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:8px 0 10px}

/* Entry cards */
.entries{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
.entry{display:flex;flex-direction:column;gap:6px;width:100%;text-align:left;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;cursor:pointer}
.entry:active{background:#F8FAFC}
.entry-top,.entry-bottom{display:flex;align-items:center;justify-content:space-between;gap:12px}
.entry-customer{font-weight:700;font-size:16px;min-width:0;overflow-wrap:anywhere}
.entry-payout{font-weight:700;font-size:16px;flex:none}
.entry-type{color:var(--muted);font-size:14px}
.entry-period{color:var(--muted);font-size:13px}
.entry-reason{margin-top:4px;padding-top:8px;border-top:1px solid var(--divider);color:var(--no);font-size:14px;overflow-wrap:anywhere}
.pill{display:inline-block;padding:3px 10px;border-radius:99px;font-size:12px;font-weight:700}
.pill.pending{background:var(--pend-bg);color:var(--pend)}
.pill.approved{background:var(--ok-bg);color:var(--ok)}
.pill.denied{background:var(--no-bg);color:var(--no)}

/* History */
.search{display:flex;gap:8px}
.search input{flex:1;min-width:0;height:48px;padding:0 14px;border:1px solid var(--input);border-radius:12px;background:var(--surface);font-size:16px}
.segments{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:4px;padding:4px;background:#E7EBF1;border-radius:12px}
.segments a{min-height:40px;display:flex;align-items:center;justify-content:center;border-radius:9px;color:var(--muted);text-decoration:none;font-size:14px;font-weight:600}
.segments a[aria-current="true"]{background:var(--surface);color:var(--text);box-shadow:0 1px 2px rgba(20,34,58,.12)}
.pager{display:flex;justify-content:space-between;gap:10px}
.pager .btn{flex:1}
.pager .btn[aria-disabled="true"]{opacity:.45;pointer-events:none}

/* Forms: 16px text keeps iOS from zooming in on focus */
.form{display:flex;flex-direction:column;gap:16px;width:100%;max-width:560px;margin:0 auto}
.form-page{width:100%;max-width:560px;margin:0 auto;display:flex;flex-direction:column;gap:16px}
.field{display:flex;flex-direction:column;gap:6px}
.field-label{font-size:14px;font-weight:600}
.field input,.field select,.readonly{width:100%;min-height:50px;padding:0 14px;border:1px solid var(--input);border-radius:12px;background:var(--surface);font-size:16px}
.field select{appearance:none;-webkit-appearance:none;padding-right:40px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235B6576' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center}
.field input:focus,.field select:focus,.search input:focus{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px #D6E3F6}
.readonly{display:flex;align-items:center;background:#EEF1F5;color:var(--muted)}
.money-input{display:flex;align-items:center;gap:6px;min-height:50px;padding:0 14px;border:1px solid var(--input);border-radius:12px;background:var(--surface);font-size:16px;font-weight:600}
.money-input:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px #D6E3F6}
.field .money-input input{flex:1;min-width:0;min-height:48px;padding:0;border:0;background:transparent;box-shadow:none}
.has-error input,.has-error select,.has-error .money-input{border-color:var(--no)}
.field-error{color:var(--no);font-size:14px;font-weight:600}
.stepper{display:grid;grid-template-columns:56px minmax(0,1fr) 56px;gap:8px}
.stepper button{height:50px;border:1px solid var(--input);border-radius:12px;background:var(--surface);font-size:24px;font-weight:600;color:var(--accent);cursor:pointer}
.stepper button[disabled]{color:var(--input);cursor:default}
.field .stepper input{text-align:center;font-weight:700;padding:0;background:#fff}
.preview{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px;border-radius:12px;background:var(--ok-bg);border:1px solid var(--ok-border);color:var(--ok);font-weight:600}
.preview strong{font-size:20px}
.form-actions{display:flex;flex-direction:column;gap:10px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px}

/* Details sheet */
.sheet-backdrop{position:fixed;inset:0;z-index:40;background:rgba(20,34,58,.45);display:flex;align-items:flex-end;justify-content:center;opacity:0;transition:opacity .2s}
.sheet-backdrop.open{opacity:1}
.sheet{width:100%;max-width:560px;max-height:88vh;max-height:88dvh;background:var(--surface);border-radius:18px 18px 0 0;display:flex;flex-direction:column;transform:translateY(100%);transition:transform .25s ease}
.sheet-backdrop.open .sheet{transform:none}
.sheet-head{display:flex;align-items:center;justify-content:space-between;padding:10px 10px 10px 16px;border-bottom:1px solid var(--divider)}
.sheet-close{width:44px;height:44px;border:0;border-radius:10px;background:transparent;font-size:16px;cursor:pointer}
.sheet-body{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:16px;display:flex;flex-direction:column;gap:14px}
.sheet-body h2{font-size:21px;overflow-wrap:anywhere}
.sheet-payout{display:flex;align-items:center;justify-content:space-between;background:var(--bg);border-radius:12px;padding:12px 14px}
.sheet-payout span{color:var(--muted);font-weight:600;font-size:13px}
.sheet-payout strong{font-size:24px}
.note{display:flex;flex-direction:column;gap:4px;border-radius:12px;padding:12px 14px;overflow-wrap:anywhere}
.note.denied{background:var(--no-bg);border:1px solid var(--no-border);color:var(--no)}
dl{margin:0;display:flex;flex-direction:column;gap:10px}
dl > div{display:grid;grid-template-columns:120px minmax(0,1fr);gap:10px}
dt{color:var(--muted)}
dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.sheet-foot{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:10px;padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--divider)}
.sheet-foot form{margin:0;display:flex}
.sheet-foot .btn{width:100%;padding:0 8px}
.sheet-body:last-child{padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}

/* Sign in */
.signin-page{background:var(--bg)}
.signin{width:100%;max-width:400px;margin:0 auto;padding:calc(48px + env(safe-area-inset-top,0px)) 20px 32px;display:flex;flex-direction:column;gap:20px}
.signin-brand{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}

/* Tablets: more room, and details open as a centered card */
@media (min-width:700px){
  .main{padding-top:28px}
  .stat-value{font-size:28px}
  .entries{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sheet-backdrop{align-items:center;padding:24px}
  .sheet{border-radius:18px;transform:translateY(24px)}
  .tabbar{justify-content:center}
  .tabbar a{flex:0 1 160px}
}
/* Phones on their side: keep the content visible above the tab bar */
@media (max-height:480px) and (orientation:landscape){
  :root{--tabbar:50px}
  .topbar{display:none}
  .tabbar a{flex-direction:row;gap:8px;font-size:13px}
  .tabbar svg{width:20px;height:20px}
  .entries{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sheet{max-height:100vh;max-height:100dvh;border-radius:0}
}
@media (prefers-reduced-motion:reduce){
  .sheet-backdrop,.sheet{transition:none}
}
