/* OfficeGuard admin UI — light "lime" theme, floating sidebar, responsive. */
:root {
  --bg: #e7ece7;
  --panel: #ffffff;
  --panel-2: #f3f6f3;
  --line: #e7eae7;
  --ink: #15181d;
  --muted: #6b7280;
  --accent: #c8ec4f;        /* lime */
  --accent-600: #b4df33;
  --accent-ink: #1d2707;    /* dark text on lime */
  --blue: #2f6fed;
  --good: #16a34a; --good-bg: #e7f6ec;
  --warn: #c2820a; --warn-bg: #fbf1da;
  --bad: #e5484d;  --bad-bg: #fbe9ea;
  --sidebar: #16181c;
  --sidebar-ink: #c9ced4;
  --sidebar-dim: #868d96;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 30px rgba(16,24,40,.06);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 4px 12px rgba(16,24,40,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1ee; color: #2a2f27; padding: 2px 7px; border-radius: 7px; font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ---------- Shell / layout ---------- */
.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.side {
  position: sticky; top: 14px; margin: 14px;
  width: 236px; flex: 0 0 236px; height: calc(100vh - 28px);
  background: var(--sidebar); color: var(--sidebar-ink);
  border-radius: 22px; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 10px 30px rgba(16,24,40,.12);
}
.brand { font-weight: 700; font-size: 17px; color: #fff; margin: 4px 8px 20px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand .tag { font-size: 9.5px; background: var(--accent); color: var(--accent-ink);
  padding: 3px 8px; border-radius: 20px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.brand.big { font-size: 26px; color: var(--ink); }

.side nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-radius: 12px; color: var(--sidebar-dim);
  font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.side nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.logout { margin-top: auto; padding: 10px 13px; color: var(--sidebar-dim); border-radius: 12px;
  transition: background .15s, color .15s; }
.logout:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }

.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 24px 30px 4px; }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 700; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#topbar-meta { color: var(--muted); font-size: 13px; }
.content { padding: 16px 30px 36px; display: flex; flex-direction: column; gap: 16px; }

/* hamburger + overlay (mobile only) */
.hamburger { display: none; border: 0; background: var(--panel); color: var(--ink);
  width: 42px; height: 42px; border-radius: 12px; font-size: 20px; cursor: pointer;
  box-shadow: var(--shadow-sm); align-items: center; justify-content: center; }
.nav-overlay { display: none; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 16px 36px rgba(16,24,40,.09); }
.card .n { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.card .l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.cards .card:nth-child(2) { background: linear-gradient(160deg, #dff39a, var(--accent)); }
.cards .card:nth-child(2) .l { color: var(--accent-ink); opacity: .8; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Tables ---------- */
.panel [id] { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { white-space: normal; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid var(--line); }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- Buttons ---------- */
.btn { background: var(--accent); color: var(--accent-ink); border: 0; padding: 9px 16px;
  border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background .15s, transform .1s, box-shadow .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--accent-600); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.danger-btn { background: var(--bad); color: #fff; }
.danger-btn:hover { background: #cf3b40; }

/* ---------- Status bits ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: middle; }
.dot.online { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.dot.idle { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.offline { background: #b6bcc2; }
.chip { background: #eef1ee; color: #4b5563; padding: 3px 9px; border-radius: 20px; font-size: 12px;
  font-weight: 500; display: inline-block; }
.chip.productive { background: var(--good-bg); color: var(--good); }
.chip.unproductive { background: var(--bad-bg); color: var(--bad); }
.bignum { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

.prodbar { display: flex; height: 24px; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.prodbar > span { display: block; height: 100%; transition: width .4s ease; }
.prodbar .productive { background: var(--good); }
.prodbar .unproductive { background: var(--bad); }
.prodbar .uncategorized { background: #cdd3d9; }
.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend b { color: var(--ink); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.legend .sw.productive { background: var(--good); }
.legend .sw.unproductive { background: var(--bad); }
.legend .sw.uncategorized { background: #cdd3d9; }
.bar { height: 7px; border-radius: 6px; background: var(--accent-600); margin-top: 5px; transition: width .4s ease; }

/* ---------- Forms ---------- */
.inline-form, .row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: 14px; max-width: 580px; }
.stack label, .inline-form label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; font-weight: 500; }
input, select, textarea { background: #fff; border: 1px solid #d9ddd9; color: var(--ink);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-family: inherit; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-600);
  box-shadow: 0 0 0 3px rgba(200,236,79,.35); }
input[type="file"] { padding: 8px; background: var(--panel-2); border-style: dashed; }
.kv { display: flex; gap: 10px; margin: 7px 0; align-items: center; flex-wrap: wrap; }
.kv span:first-child { width: 130px; color: var(--muted); font-size: 13px; }
.enroll { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.fieldset legend { padding: 0 8px; color: var(--muted); font-size: 12.5px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.check input { width: auto; }
.applist { display: flex; flex-wrap: wrap; gap: 6px; max-height: 320px; overflow: auto; }
#app-filter { max-width: 220px; }

/* ---------- Screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.shots figure { margin: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.shots img { width: 100%; display: block; }
.shots figcaption { padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* ---------- Badge / commands / danger ---------- */
.badge { background: var(--bad); color: #fff; border-radius: 20px; padding: 1px 7px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.cmd-ok { color: var(--good); } .cmd-wait { color: var(--warn); } .cmd-fail { color: var(--bad); }
.panel.danger { border: 1px solid #f3c7c9; background: #fdf5f5; }
.panel.danger h2 { color: var(--bad); }
.links { list-style: none; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Login (legacy, kept) ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--panel); border-radius: 20px; box-shadow: var(--shadow);
  padding: 32px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; }

/* ---------- Auth (two-panel sign in) ---------- */
.auth-body { margin: 0; background: var(--bg); }
.auth { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 100vh; }
.auth-brand {
  background: radial-gradient(760px 420px at 18% 12%, rgba(200,236,79,.20), transparent 62%), var(--sidebar);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-logo { display: flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 700; }
.auth-logo .mark, .auth-badge { background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; }
.auth-logo .mark { width: 34px; height: 34px; border-radius: 10px; }
.auth-brand h2 { font-size: 30px; line-height: 1.22; margin: 4px 0 0; max-width: 13ch; letter-spacing: -0.02em; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 13px; }
.auth-points li { display: flex; align-items: center; gap: 11px; color: var(--sidebar-ink); font-size: 14.5px; }
.auth-points .tick { width: 22px; height: 22px; border-radius: 50%; background: rgba(200,236,79,.16);
  color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.auth-foot { margin-top: auto; color: var(--sidebar-dim); font-size: 12.5px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); padding: 36px;
  width: 100%; max-width: 384px; display: flex; flex-direction: column; gap: 14px; }
.auth-badge { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 4px; }
.auth-card h1 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.auth-card > .muted { margin: -8px 0 6px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.btn-lg { width: 100%; justify-content: center; padding: 12px; font-size: 14.5px; margin-top: 4px; }
.auth-link { text-align: center; font-size: 13px; }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-main { min-height: 100vh; padding: 20px; }
}

/* ---------- Trend chart ---------- */
#trend-chart svg { max-width: 100%; height: auto; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hamburger { display: inline-flex; }
  .side {
    position: fixed; left: 0; top: 0; margin: 0; height: 100vh; width: 264px;
    border-radius: 0 22px 22px 0; transform: translateX(-112%);
    transition: transform .22s ease; z-index: 60;
  }
  body.nav-open .side { transform: none; }
  .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(10,14,10,.45);
    z-index: 50; opacity: 0; pointer-events: none; transition: opacity .22s; }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 14px 16px 6px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 10px 16px 28px; gap: 14px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .n { font-size: 26px; }
  .panel { padding: 16px; border-radius: 14px; }
  .row-actions .btn, .inline-form .btn { width: 100%; justify-content: center; }
  .inline-form, .stack { width: 100%; }
  .inline-form label, .inline-form input, .inline-form select { width: 100%; }
  th, td { padding: 8px 9px; font-size: 13px; }
}
