/* ============================================================
   Personal Service Center — Technician Tracking System
   Compact modern UI · responsive (desktop / tablet / mobile)
   ============================================================ */
:root {
  --bg: #0a0f1c;
  --bg2: #0d1526;
  --panel: #101a30;
  --panel2: #16223d;
  --line: rgba(148, 163, 200, 0.14);
  --line2: rgba(148, 163, 200, 0.24);
  --text: #e7ecf6;
  --muted: #8fa0bd;
  --muted2: #64748f;
  --accent: #4f8cff;
  --accent2: #7aa7ff;
  --green: #2dd4a7;
  --red: #f87171;
  --amber: #fbbf24;
  --purple: #b48cff;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(2, 6, 18, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 700px at 85% -10%, rgba(79, 140, 255, 0.14), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(45, 212, 167, 0.08), transparent 55%), var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 100vh;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #243350; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(180deg, rgba(22,34,61,.95), rgba(16,26,48,.95));
  border: 1px solid var(--line); border-radius: 16px; padding: 28px 26px; box-shadow: var(--shadow);
}
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #4f8cff, #2dd4a7);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; color: #06101f;
}
.brand-logo-img {
  width: 46px; height: 46px; border-radius: 12px; flex: none; object-fit: cover;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); background: #fff;
}
.brand-logo-img.sm { width: 34px; height: 34px; border-radius: 9px; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.login-card h1 { font-size: 18px; margin: 18px 0 4px; }
.login-card .hint { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.demo-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.demo-btn {
  font-size: 11px; padding: 5px 9px; border-radius: 999px; cursor: pointer;
  background: rgba(79,140,255,.1); border: 1px solid rgba(79,140,255,.35); color: var(--accent2);
}
.demo-btn:hover { background: rgba(79,140,255,.2); }

/* ---------- forms ---------- */
label.f { display: block; font-size: 11.5px; color: var(--muted); margin: 0 0 4px 2px; font-weight: 600; letter-spacing: .3px; }
input, select, textarea {
  width: 100%; background: #0c1424; color: var(--text);
  border: 1px solid var(--line2); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: var(--font);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.18); }
input:disabled, select:disabled, input[readonly] { background: #131d33; color: var(--muted); cursor: not-allowed; }
input[type="date"], input[type="time"] { color-scheme: dark; }
textarea { resize: vertical; min-height: 60px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; padding: 8px 14px; font-family: var(--font);
  transition: filter .15s, background .15s; white-space: nowrap; min-height: 34px;
}
.btn-primary { background: linear-gradient(135deg, #4f8cff, #3b6fe0); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost { background: transparent; border-color: var(--line2); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-green { background: linear-gradient(135deg, #17b58a, #0f9472); color: #04110c; }
.btn-danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); color: #f8a5a5; }
.btn-danger:hover { background: rgba(248,113,113,.22); }
.btn-sm { padding: 4px 9px; min-height: 28px; font-size: 11.5px; border-radius: 6px; }
.btn-icon { padding: 6px 8px; }

/* ---------- layout ---------- */
.app { display: none; min-height: 100vh; }
.app.on { display: block; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: rgba(10, 15, 28, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 9px 16px;
}
.topbar .brand-row { margin: 0; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #b48cff, #4f8cff); color: #0a0f1c;
  font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.user-meta { line-height: 1.15; text-align: right; }
.user-meta .nm { font-size: 12.5px; font-weight: 700; }
.user-meta .rl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

.main { display: flex; }
.sidebar {
  width: 212px; flex: none; padding: 14px 10px; border-right: 1px solid var(--line);
  min-height: calc(100vh - 52px); position: sticky; top: 52px; align-self: flex-start;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 3px;
  border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px;
  border: 1px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(79,140,255,.07); }
.nav-item.active { color: #fff; background: linear-gradient(135deg, rgba(79,140,255,.25), rgba(45,212,167,.12)); border-color: rgba(79,140,255,.45); }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted2); margin: 14px 6px 6px; }

.content { flex: 1; padding: 18px 20px 90px; max-width: 1500px; min-width: 0; }

/* mobile bottom nav */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 14px 12px 84px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(13, 21, 38, 0.97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-item { flex: 1; flex-direction: column; gap: 3px; font-size: 10px; padding: 7px 2px; margin: 0; border-radius: 10px; text-align: center; }
  .bottom-nav .nav-item svg { width: 19px; height: 19px; }
}

/* ---------- page & cards ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h2 { font-size: 18px; letter-spacing: .2px; }
.page-head .sub { color: var(--muted); font-size: 12px; width: 100%; margin-top: -6px; }
.page-head .spacer { flex: 1; }

.card {
  background: linear-gradient(180deg, rgba(22,34,61,.55), rgba(16,26,48,.55));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.card h3 { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 10px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; }
.kpi .k-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.kpi .k-val { font-size: 22px; font-weight: 800; margin-top: 3px; letter-spacing: .3px; }
.kpi .k-sub { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.kpi .k-ico { position: absolute; right: 10px; top: 10px; opacity: .5; }
.k-green .k-val { color: var(--green); }
.k-blue .k-val { color: var(--accent2); }
.k-purple .k-val { color: var(--purple); }
.k-amber .k-val { color: var(--amber); }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-bottom: 12px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 1100px) { .three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .three-col { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(12, 19, 35, .5); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
.tbl thead th {
  position: sticky; top: 0; background: #131d33; color: var(--muted);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; text-align: left;
  padding: 8px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; z-index: 5;
}
.tbl tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.tbl tbody tr:hover { background: rgba(79, 140, 255, 0.06); }
.tbl tbody tr:last-child td { border-bottom: none; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.td-wrap { white-space: normal; min-width: 180px; }

/* status chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; letter-spacing: .3px; white-space: nowrap;
}
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-prog { background: rgba(79,140,255,.14); color: #8db4ff; }
.chip-wcust { background: rgba(251,191,36,.13); color: #ffd675; }
.chip-wpart { background: rgba(180,140,255,.14); color: #cdb2ff; }
.chip-done { background: rgba(45,212,167,.13); color: #6fe7c4; }
.chip-open { background: rgba(148,163,200,.12); color: #a9b7d4; }
.chip-revisit { background: rgba(248,113,113,.13); color: #ffa1a1; }
.chip-co { background: rgba(251,191,36,.1); color: #fcd34d; border: 1px dashed rgba(251,191,36,.4); }
.chip-co::before { display: none; }

.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

/* filters bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.filters .f-group { display: flex; flex-direction: column; min-width: 130px; }
.filters select, .filters input { padding: 6px 9px; font-size: 12.5px; }
.filters .search-box { flex: 1; min-width: 170px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

/* segment control */
.seg { display: inline-flex; background: #0c1424; border: 1px solid var(--line2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button {
  border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; cursor: pointer; font-family: var(--font);
}
.seg button.on { background: linear-gradient(135deg, #4f8cff, #3b6fe0); color: #fff; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent2); border-bottom-color: var(--accent); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4, 8, 18, 0.72); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 30px 14px; overflow-y: auto;
}
.modal-overlay.on { display: flex; }
.modal {
  width: 100%; max-width: 620px; background: linear-gradient(180deg, #18233d, #121c33);
  border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 20px 16px;
}
.modal-head { display: flex; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 15.5px; }
.modal-head .spacer { flex: 1; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: rgba(148,163,200,.12); }

/* toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1b2a47; border: 1px solid var(--line2); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(248,113,113,.5); background: #3a1a24; }
#toast.ok { border-color: rgba(45,212,167,.5); }

/* timeline */
.timeline { list-style: none; margin-top: 6px; }
.timeline li { position: relative; padding: 0 0 14px 26px; }
.timeline li::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: -4px; width: 2px; background: var(--line2);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent); background: #0c1424; display: flex; align-items: center; justify-content: center;
}
.timeline .dot.done { border-color: var(--green); }
.timeline .t-title { font-weight: 700; font-size: 13px; }
.timeline .t-when { font-size: 11.5px; color: var(--muted); }
.timeline .t-note { font-size: 11.5px; color: var(--muted2); }
.big-dur { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: 10px; background: rgba(45,212,167,.08); border: 1px solid rgba(45,212,167,.25); margin-bottom: 12px; }
.big-dur .bd-val { font-size: 20px; font-weight: 800; color: var(--green); }
.big-dur .bd-lab { font-size: 11px; color: var(--muted); }

/* ranking list */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-badge {
  width: 24px; height: 24px; border-radius: 7px; flex: none; font-size: 11.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; background: #1c2947; color: var(--muted);
}
.rank-1 { background: linear-gradient(135deg, #ffd166, #f4a63a); color: #2b1a00; }
.rank-2 { background: linear-gradient(135deg, #d7dde8, #a9b4c7); color: #232b3a; }
.rank-3 { background: linear-gradient(135deg, #e8a06b, #c77b42); color: #2b1400; }
.rank-row .r-name { flex: 1; font-weight: 600; font-size: 12.5px; }
.rank-row .r-val { font-weight: 800; font-size: 13px; }
.rank-bar { height: 4px; border-radius: 4px; background: #1a2745; margin-top: 3px; overflow: hidden; }
.rank-bar > div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--green)); }

/* mini stats rows */
.stat-line { display: flex; justify-content: space-between; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.stat-line:last-child { border-bottom: none; }
.stat-line b { font-variant-numeric: tabular-nums; }

/* empty state */
.empty { text-align: center; color: var(--muted2); padding: 34px 10px; font-size: 13px; }
.empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 8px; }

/* legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* mobile card list (tables -> cards on small screens for daily logs) */
@media (max-width: 720px) {
  .tbl-desktop { display: table; }
}
.item-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.item-chip { font-size: 10.5px; background: rgba(79,140,255,.1); border: 1px solid rgba(79,140,255,.25); color: #9dc0ff; padding: 2px 7px; border-radius: 6px; font-weight: 700; }
.item-chip.dsk { background: rgba(45,212,167,.08); border-color: rgba(45,212,167,.25); color: #7fe9c9; }
.item-chip.sys { background: rgba(180,140,255,.1); border-color: rgba(180,140,255,.3); color: #cdb2ff; }

/* users page */
.u-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.u-dot.on { background: var(--green); }
.u-dot.off { background: var(--red); }

/* misc */
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.pill { font-size: 10.5px; background: rgba(148,163,200,.12); color: var(--muted); padding: 2px 8px; border-radius: 999px; font-weight: 700; }
a { color: var(--accent2); }

/* print */
@media print {
  body { background: #fff; color: #111; }
  .topbar, .sidebar, .bottom-nav, .filters, .toolbar, .form-foot { display: none !important; }
  .card { border: 1px solid #ccc; background: #fff; }
  .content { padding: 0; max-width: none; }
}
