:root {
  --bg: #f1f5f9; --card: #ffffff; --text: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --accent: #059669; --accent-soft: #d1fae5;
  --red: #dc2626; --red-soft: #fee2e2; --amber: #d97706; --amber-soft: #fef3c7;
  --blue: #2563eb; --blue-soft: #dbeafe; --teal: #0d9488; --teal-soft: #ccfbf1;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.06);
  --radius: 16px;
}
html[data-theme="dark"] {
  --bg: #0f172a; --card: #1e293b; --text: #e2e8f0; --muted: #94a3b8;
  --line: #334155; --accent: #34d399; --accent-soft: #064e3b;
  --red: #f87171; --red-soft: #7f1d1d; --amber: #fbbf24; --amber-soft: #78350f;
  --blue: #60a5fa; --blue-soft: #1e3a8a; --teal: #2dd4bf; --teal-soft: #134e4a;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

header.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; }
.logo .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); display: inline-block; }

button, .btn {
  font-family: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); padding: 9px 16px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
html[data-theme="dark"] .btn-primary { color: #052e22; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-big { font-size: 20px; padding: 18px 28px; border-radius: 18px; width: 100%; font-weight: 700; }

input, select, textarea {
  font-family: inherit; font-size: 15px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
label { font-size: 13px; color: var(--muted); font-weight: 600; display: block; margin: 12px 0 4px; }
textarea { resize: vertical; min-height: 64px; }

/* task type big buttons */
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-btn { text-align: left; padding: 10px 12px; border-radius: 14px; }
.type-btn .em { font-size: 20px; }
.type-btn .lb { font-weight: 700; font-size: 14px; }
.type-btn .ht { font-size: 11px; color: var(--muted); }
.type-btn.sel { border-color: var(--accent); background: var(--accent-soft); }

/* chips + day dots */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.st-worked { background: var(--accent-soft); color: var(--accent); }
.st-missed { background: var(--red-soft); color: var(--red); }
.st-pending { background: var(--amber-soft); color: var(--amber); }
.st-leave { background: var(--amber-soft); color: var(--amber); }
.st-holiday { background: var(--line); color: var(--muted); }
.st-covered { background: var(--blue-soft); color: var(--blue); }
.st-sunday-worked { background: var(--teal-soft); color: var(--teal); }
.st-future, .st-before { background: transparent; color: var(--muted); }

.dot7 { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; border: 1px solid var(--line); }
.d-worked { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.d-missed { background: var(--red-soft); color: var(--red); border-color: transparent; }
.d-pending { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.d-leave { background: var(--amber-soft); color: var(--amber); }
.d-holiday { background: var(--line); color: var(--muted); border-color: transparent; }
.d-covered { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.d-sunday-worked { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.d-future, .d-before { opacity: .45; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* calendar grid */
.calwrap { overflow-x: auto; }
.calgrid td, .calgrid th { padding: 3px; text-align: center; border-bottom: none; }
.cell { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; cursor: pointer; border: 1px solid var(--line); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.tab.sel { background: var(--accent); color: #fff; border-color: var(--accent); }
html[data-theme="dark"] .tab.sel { color: #052e22; }

.entry { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.entry:last-child { border-bottom: none; }
.entry .em { font-size: 22px; }
.entry img.thumb { max-height: 60px; border-radius: 8px; border: 1px solid var(--line); }

.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; margin-right: 5px; }
@keyframes pulse { 0% {opacity:.4} 50% {opacity:1} 100% {opacity:.4} }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); }

.login-box { max-width: 380px; margin: 9vh auto 0; }
.timer { font-size: 34px; font-weight: 800; letter-spacing: 1px; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .wrap { padding: 10px; }
  .types { grid-template-columns: repeat(2, 1fr); }
  body { font-size: 15px; }
}
