/* ============================================================
   TimeTrack dashboard - styles
   ============================================================ */
:root {
  --bg:        #0f1216;
  --bg-2:      #161b22;
  --panel:     #1b2129;
  --panel-2:   #222a34;
  --line:      #2a333f;
  --text:      #e6edf3;
  --muted:     #8b98a9;
  --muted-2:   #5f6b7a;
  --accent:    #4f8cff;
  --accent-2:  #3b6fd4;
  --green:     #37c871;
  --amber:     #f5a623;
  --red:       #ef4b5c;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 30px rgba(0,0,0,.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2530 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow);
}
.login-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-card .logo .dot { width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #8a5cff); }
.login-card h1 { font-size: 18px; font-weight: 600; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }

label { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
input, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; padding: 10px 16px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; margin-top: 20px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 12px; }

.form-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column;
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.sidebar .logo .dot { width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #8a5cff); }
.sidebar .logo b { font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  padding: 9px 10px; border-radius: var(--radius-sm); font-weight: 500;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav a svg { width: 17px; height: 17px; opacity: .9; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid var(--line); padding-top: 14px; }
.userbox .who { font-size: 13px; font-weight: 500; }
.userbox .role { font-size: 11px; color: var(--muted); text-transform: capitalize; }

.main { padding: 24px 28px; overflow-y: auto; height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 10px; }

/* ---------- Cards / grid ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 26px; font-weight: 600; margin-top: 4px; }
.card .v small { font-size: 13px; color: var(--muted); font-weight: 400; }

/* ---------- Table ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel h3 { font-size: 14px; font-weight: 600; padding: 15px 16px; border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.clickable { cursor: pointer; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge.online { background: rgba(55,200,113,.12); color: var(--green); }
.badge.online .dot { background: var(--green); }
.badge.offline { background: rgba(139,152,169,.1); color: var(--muted); }
.badge.offline .dot { background: var(--muted-2); }
.badge.ot { background: rgba(79,140,255,.14); color: var(--accent); }
.badge.ot .dot { background: var(--accent); }
.badge.warn { background: rgba(245,166,35,.14); color: var(--amber); }
.badge.warn .dot { background: var(--amber); }
.badge.bad { background: rgba(239,75,92,.14); color: var(--red); }
.badge.bad .dot { background: var(--red); }
.badge.offday { background: rgba(139,152,169,.1); color: var(--muted); }
.badge.offday .dot { background: var(--muted-2); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); text-transform: capitalize; }

/* ---------- Activity bar meter ---------- */
.meter { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; min-width: 90px; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #6fe39a); }

/* ---------- Activity timeline ---------- */
.timeline { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding: 12px 16px; overflow-x: auto; }
.timeline .bar { flex: 0 0 5px; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.timeline .bar.idle { background: var(--panel-2); }

/* ---------- Screenshot grid ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.shot { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.shot img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--bg-2); cursor: zoom-in; }
.shot .meta { padding: 8px 10px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.shot .meta .app { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal / lightbox ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 24px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 460px; box-shadow: var(--shadow); }
.modal header { padding: 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { font-size: 15px; font-weight: 600; }
.modal .body { padding: 16px; }
.modal footer { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); }
.x { background: transparent; border: 0; color: var(--muted); font-size: 20px; line-height: 1; }

/* ---------- Dashboard overview ---------- */
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ov-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ov-row:last-child { border-bottom: 0; }
.ov-row:hover { background: var(--panel-2); }
.ov-name { display: flex; align-items: center; gap: 9px; min-width: 140px; font-size: 13px; font-weight: 500; }
.ov-val { font-size: 13px; font-weight: 600; min-width: 60px; text-align: right; }
.dot-s { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.warn-tri { color: var(--amber); font-size: 11px; }
@media (max-width: 820px) { .ov-grid { grid-template-columns: 1fr; } }

.empty { color: var(--muted); text-align: center; padding: 40px; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.note { font-size: 12px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 18px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { height: auto; }
}
