:root{
  --bg:#f5f6f3; --card:#ffffff; --ink:#18201b; --muted:#66706a; --line:#e2e5e0;
  --brand:#1f5c3a; --brand-2:#2f7d4f; --brand-soft:#e6f1ea;
  --red:#c0392b; --red-soft:#fbeae8; --amber:#b7791f; --amber-soft:#fdf3e1;
  --blue:#2563a8; --blue-soft:#e7eff9; --gray-soft:#eef0ed;
  --radius:10px; --shadow:0 1px 2px rgba(0,0,0,.05),0 2px 8px rgba(0,0,0,.04);
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.45 Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}
.hidden{display:none!important}
h1,h2,h3{margin:0;font-weight:600;letter-spacing:-.01em}
h1{font-size:22px} h2{font-size:17px} h3{font-size:14px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;font-size:12px}
a{color:var(--brand-2)}
.muted{color:var(--muted)} .err{color:var(--red);min-height:1em}
.small{font-size:12px}

/* login */
.login{min-height:100vh;display:grid;place-items:center;padding:16px}
.login-card{background:var(--card);padding:28px;border-radius:14px;box-shadow:var(--shadow);width:100%;max-width:360px;display:grid;gap:12px;text-align:center}
.login-card label{text-align:left}
.brand-mark{width:44px;height:44px;border-radius:10px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700;font-size:20px;margin:0 auto}
.brand-mark.sm{width:28px;height:28px;font-size:14px;border-radius:7px;margin:0}

/* layout */
.topbar{position:sticky;top:0;z-index:20;background:var(--brand);color:#fff;display:flex;align-items:center;gap:16px;padding:10px 16px}
.brand{display:flex;align-items:center;gap:8px;font-weight:600}
.brand .brand-mark{background:#fff;color:var(--brand)}
.nav{display:flex;gap:4px;flex:1;overflow-x:auto}
.nav a,.bottom-nav a{color:rgba(255,255,255,.8);text-decoration:none;padding:6px 10px;border-radius:7px;white-space:nowrap;font-weight:500}
.nav a.active{background:rgba(255,255,255,.16);color:#fff}
.who{display:flex;align-items:center;gap:8px;font-size:13px}
.view{max-width:1200px;margin:0 auto;padding:16px 16px 90px}
.bottom-nav{display:none}
@media (max-width:760px){
  .nav,.who #whoName{display:none}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:20;background:var(--card);border-top:1px solid var(--line);justify-content:space-around;padding:6px 4px calc(6px + env(safe-area-inset-bottom))}
  .bottom-nav a{color:var(--muted);font-size:11px;padding:4px 6px;display:flex;flex-direction:column;align-items:center;gap:2px}
  .bottom-nav a .ico{font-size:18px;line-height:1}
  .bottom-nav a.active{color:var(--brand)}
  .topbar{justify-content:space-between}
}

/* page header */
.page-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:4px 0 14px;flex-wrap:wrap}
.page-head .actions{display:flex;gap:8px;flex-wrap:wrap}

/* cards */
.grid{display:grid;gap:14px}
.grid.cols-2{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:14px}
.card > h3{margin-bottom:10px;display:flex;justify-content:space-between;align-items:center}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:14px}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px}
.kpi .label{font-size:12px;color:var(--muted)}
.kpi .value{font-size:24px;font-weight:700;letter-spacing:-.02em;margin-top:2px;font-variant-numeric:tabular-nums}
.kpi .sub{font-size:12px;color:var(--muted)}
.kpi.warn .value{color:var(--red)}
.kpi.good .value{color:var(--brand-2)}

/* lists */
.list{display:flex;flex-direction:column}
.row{display:flex;align-items:center;gap:10px;padding:10px 4px;border-top:1px solid var(--line);cursor:pointer}
.row:first-child{border-top:0}
.row:hover{background:#fafbf9}
.row .main{flex:1;min-width:0}
.row .title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .meta{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .right{text-align:right;font-size:12px;white-space:nowrap}
.empty{color:var(--muted);padding:14px 4px;font-size:13px}

/* tables */
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
th,td{text-align:left;padding:8px 8px;border-bottom:1px solid var(--line);white-space:nowrap}
th{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:600}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
tbody tr{cursor:pointer} tbody tr:hover{background:#fafbf9}
tfoot td{font-weight:600}

/* badges */
.badge{display:inline-block;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:600;background:var(--gray-soft);color:var(--muted);white-space:nowrap}
.badge.green{background:var(--brand-soft);color:var(--brand)}
.badge.red{background:var(--red-soft);color:var(--red)}
.badge.amber{background:var(--amber-soft);color:var(--amber)}
.badge.blue{background:var(--blue-soft);color:var(--blue)}
.overdue{color:var(--red);font-weight:600}

/* chips */
.chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.chip{border:1px solid var(--line);background:var(--card);padding:5px 10px;border-radius:999px;font-size:12px;cursor:pointer;font-weight:500;color:var(--ink)}
.chip.active{background:var(--brand);border-color:var(--brand);color:#fff}
.chip .n{opacity:.7;margin-left:4px}

/* forms */
label{display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:500;color:var(--muted)}
input,select,textarea{font:inherit;color:var(--ink);border:1px solid var(--line);border-radius:8px;padding:8px 10px;background:#fff;width:100%;min-height:38px}
textarea{min-height:70px;resize:vertical}
input:focus,select:focus,textarea:focus{outline:2px solid var(--brand-soft);border-color:var(--brand-2)}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}
.form-grid .full{grid-column:1/-1}
.check{flex-direction:row;align-items:center;gap:8px;color:var(--ink);font-size:13px}
.check input{width:auto;min-height:0}
.form-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px;flex-wrap:wrap}
.search{max-width:280px}
.hint{font-size:12px;color:var(--muted);background:var(--gray-soft);border-radius:8px;padding:8px 10px}
.hint.warn{background:var(--amber-soft);color:var(--amber)}

/* buttons */
.btn{font:inherit;font-weight:600;border:1px solid var(--line);background:var(--card);color:var(--ink);padding:8px 14px;border-radius:8px;cursor:pointer;min-height:38px;white-space:nowrap}
.btn:hover{border-color:#cdd2cb}
.btn.primary{background:var(--brand);color:#fff;border-color:var(--brand)}
.btn.primary:hover{background:var(--brand-2)}
.btn.danger{color:var(--red)}
.btn.ghost{background:transparent;border-color:rgba(255,255,255,.35);color:#fff}
.btn.sm{padding:4px 10px;min-height:30px;font-size:12px}
.btn.block{width:100%}
.btn:disabled{opacity:.5;cursor:default}
.icon-btn{border:0;background:transparent;font-size:18px;cursor:pointer;color:var(--muted);padding:4px 8px}

/* modal */
.modal{position:fixed;inset:0;background:rgba(15,20,17,.45);z-index:50;display:flex;align-items:flex-start;justify-content:center;padding:40px 16px;overflow-y:auto}
.modal-card{background:var(--card);border-radius:14px;width:100%;max-width:720px;box-shadow:0 10px 40px rgba(0,0,0,.2)}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line)}
.modal-body{padding:16px}
@media (max-width:760px){.modal{padding:0}.modal-card{border-radius:0;min-height:100vh}}

/* detail */
.detail-top{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px 16px;margin:10px 0 14px}
.facts div span{display:block;font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.timeline{border-left:2px solid var(--line);margin-left:6px;padding-left:14px;display:flex;flex-direction:column;gap:10px}
.tl-item{position:relative;font-size:13px}
.tl-item::before{content:"";position:absolute;left:-20px;top:5px;width:10px;height:10px;border-radius:50%;background:var(--brand-2);border:2px solid #fff}
.tl-item.stage::before{background:var(--blue)}
.tl-item .when{font-size:11px;color:var(--muted)}
.section{margin-top:16px}
.section > h3{margin-bottom:8px}
.box{border:1px solid var(--line);border-radius:var(--radius);padding:12px;background:#fbfcfa}

/* bars */
.bars{display:flex;flex-direction:column;gap:7px}
.bar-row{display:grid;grid-template-columns:120px 1fr 64px;gap:8px;align-items:center;font-size:12px}
.bar-track{height:10px;background:var(--gray-soft);border-radius:5px;overflow:hidden}
.bar-fill{height:100%;background:var(--brand-2);border-radius:5px}
.bar-row .v{text-align:right;font-variant-numeric:tabular-nums;color:var(--ink);font-weight:600}
.cols{display:flex;align-items:flex-end;gap:4px;height:120px;padding-top:8px}
.col{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;height:100%;justify-content:flex-end}
.col .stick{width:100%;max-width:28px;background:var(--brand-2);border-radius:4px 4px 0 0;min-height:2px}
.col .cl{font-size:10px;color:var(--muted)}
.col .cv{font-size:10px;font-weight:600}
.funnel{display:flex;flex-direction:column;gap:6px}

/* toast */
.toast{position:fixed;left:50%;bottom:80px;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 16px;border-radius:8px;z-index:60;font-size:13px;box-shadow:var(--shadow)}
.toast.err{background:var(--red)}

.login-logo{width:120px;height:auto;margin:0 auto 4px;display:block}
.logo-chip{background:#fff;border-radius:8px;padding:3px 5px;display:inline-flex;align-items:center}
.logo-chip img{height:26px;width:auto;display:block}
.seg{display:flex;gap:6px;flex-wrap:wrap}
.seg button{flex:1;min-width:120px}
.seg button.on{background:var(--brand);color:#fff;border-color:var(--brand)}

.clock-card{text-align:center;padding:22px 14px;margin-bottom:14px}
.clock-state{font-weight:600;font-size:15px}
.clock-state.in{color:var(--brand-2)} .clock-state.break{color:var(--amber)} .clock-state.out{color:var(--muted)}
.clock-time{font-size:40px;font-weight:700;letter-spacing:-.02em;margin-top:6px;font-variant-numeric:tabular-nums}
.clock-btns{display:flex;gap:10px;justify-content:center;margin-top:16px;flex-wrap:wrap}
.btn.big{min-height:52px;padding:12px 28px;font-size:16px;min-width:150px}
