:root {
  --bg: #0f1220;
  --bg-soft: #171a2e;
  --card: #ffffff;
  --ink: #10132a;
  --ink-soft: #5b607a;
  --line: #e7e9f2;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef0ff;
  --green: #12b76a;
  --green-soft: #e7f8f0;
  --amber: #f59e0b;
  --red: #ef4444;
  --red-soft: #fdecec;
  --shadow: 0 10px 30px rgba(16, 19, 42, 0.10);
  --shadow-lg: 0 24px 60px rgba(16, 19, 42, 0.18);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 15% -10%, #2a2f57 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 10%, #3a2f6e 0%, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

.brand-mark {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 800; letter-spacing: -0.02em;
}
.brand-badge {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px rgba(79,70,229,0.45);
}
.brand-name { font-size: 20px; }
.brand-name span { color: #a5b4fc; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 34px 32px;
}
.login-card .brand-mark { color: var(--ink); margin-bottom: 6px; }
.login-card .brand-name span { color: var(--brand); }
.login-sub { color: var(--ink-soft); font-size: 14px; margin: 4px 0 26px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 7px; color: var(--ink); }
.field { margin-bottom: 16px; }
input, select {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fbfbfe;
  color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft); background: #fff;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 700; font-size: 15px;
  padding: 12px 18px; border-radius: 12px; transition: transform .06s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn-ghost:hover { filter: brightness(0.98); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.alert {
  padding: 11px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; display: none;
}
.alert.show { display: block; }
.alert-error { background: var(--red-soft); color: #b42318; }
.alert-ok { background: var(--green-soft); color: #067647; }

/* ---------- App shell ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 26px; color: #fff;
}
.topbar .brand-name { color: #fff; }
.topbar .brand-name span { color: #a5b4fc; }
.top-right { display: flex; align-items: center; gap: 14px; }
.who { font-size: 14px; color: #c7cbe6; }
.who b { color: #fff; }
.link-btn {
  background: rgba(255,255,255,0.10); color: #fff; border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.link-btn:hover { background: rgba(255,255,255,0.18); }

.page { max-width: 1100px; margin: 0 auto; padding: 10px 26px 60px; }
.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px;
}

/* ---------- Employee break card ---------- */
.break-card { max-width: 560px; margin: 24px auto 0; text-align: center; padding: 40px 32px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 15px; border-radius: 999px; font-weight: 700; font-size: 13px;
  margin-bottom: 22px;
}
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.pill-idle { background: #eef0ff; color: var(--brand-dark); }
.pill-idle .dot { background: var(--brand); }
.pill-break { background: var(--green-soft); color: #067647; }
.pill-break .dot { background: var(--green); animation: pulse 1.4s infinite; }
.pill-over { background: var(--red-soft); color: #b42318; }
.pill-over .dot { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.35)} 100%{opacity:1;transform:scale(1)} }

.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: -0.02em;
  font-size: 68px; line-height: 1; margin: 6px 0 4px; color: var(--ink);
}
.timer.over { color: var(--red); }
.timer-label { color: var(--ink-soft); font-size: 14px; margin-bottom: 26px; }

.big-btn {
  width: 220px; height: 220px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 19px; font-weight: 800; color: #fff; margin: 4px auto 22px; display: block;
  transition: transform .08s, filter .15s, box-shadow .2s;
}
.big-btn:active { transform: scale(0.97); }
.big-btn:disabled { cursor: not-allowed; filter: grayscale(0.5) opacity(0.7); }
.big-start { background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 16px 40px rgba(79,70,229,0.45); }
.big-start:hover:not(:disabled) { filter: brightness(1.06); }
.big-stop  { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 16px 40px rgba(239,68,68,0.45); }
.big-stop:hover:not(:disabled) { filter: brightness(1.06); }
.big-btn .ico { display:block; font-size: 30px; margin-bottom: 6px; }

.limit-bar { height: 12px; background: #eef0f6; border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.limit-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #4338ca); border-radius: 999px; transition: width .4s, background .3s; }
.limit-fill.warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.limit-fill.full { background: linear-gradient(90deg, #ef4444, #dc2626); }
.limit-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); }
.limit-meta b { color: var(--ink); }

.no-break {
  margin-top: 20px; background: var(--red-soft); color: #b42318;
  padding: 14px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; display: none;
}
.no-break.show { display: block; }

.mini-history { margin-top: 22px; text-align: left; }
.mini-history h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.mini-row { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* ---------- Admin ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0; }
.stat { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat .l { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.stat.green .n { color: var(--green); }
.stat.red .n { color: var(--red); }
.stat.brand .n { color: var(--brand); }

.section-title { color: #fff; font-size: 15px; font-weight: 700; margin: 26px 0 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; font-size: 14px; }
th { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--line); }
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; }
.tag-break { background: var(--green-soft); color: #067647; } .tag-break .dot{ background: var(--green);}
.tag-idle { background: #eef1f6; color: #566; } .tag-idle .dot{ background:#94a3b8;}
.tag-over { background: var(--red-soft); color: #b42318; } .tag-over .dot{ background: var(--red);}
.tag-off { background: #f1f2f6; color:#98a; } .tag-off .dot{ background:#c9ccdd;}

.bar { height: 8px; background: #eef0f6; border-radius: 999px; overflow: hidden; width: 130px; display:inline-block; vertical-align: middle;}
.bar > span { display:block; height:100%; background: var(--brand); border-radius:999px; }
.bar > span.warn { background: var(--amber); }
.bar > span.full { background: var(--red); }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.muted { color: var(--ink-soft); font-size: 13px; }
.row-actions { display: flex; gap: 8px; }
.form-inline .field { margin-bottom: 12px; }
.cred-note { background: var(--green-soft); color:#067647; padding:12px 14px; border-radius:12px; font-size:14px; margin-top:12px; display:none; }
.cred-note.show{ display:block; }
.cred-note code{ background:#fff; padding:2px 6px; border-radius:6px; }

@media (max-width: 860px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .timer { font-size: 56px; }
}
