:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --muted: #6b7280;
  --accent: #16824c;
  --accent-dark: #0f5c35;
  --danger: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

header.topbar h1 {
  font-size: 20px;
  margin: 0;
}

button {
  cursor: pointer;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px 14px;
  font-size: 14px;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:disabled { cursor: not-allowed; opacity: 0.6; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--accent-dark); }

button.danger {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff;
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.panel h2 {
  margin-top: 0;
  font-size: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.on { background: #e6f6ee; color: var(--accent-dark); }
.badge.off { background: #f2f2f2; color: var(--muted); }
.badge.error { background: #fdecea; color: var(--danger); }
.badge.ok { background: #e6f6ee; color: var(--accent-dark); }

.days {
  display: flex;
  gap: 4px;
}
.day-chip {
  font-size: 11px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f1f3;
  color: var(--muted);
}
.day-chip.active { background: var(--accent); color: #fff; }

.row-actions {
  display: flex;
  gap: 6px;
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.hidden { display: none !important; }

.modal {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  margin: 5vh 0;
}

.modal h2 { margin-top: 0; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="time"],
.field input[type="date"],
.field input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 130, 76, 0.15);
}

.vacation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.vacation-item button {
  padding: 2px 8px;
  font-size: 12px;
}

.day-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.day-picker label {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

.time-row { display: flex; gap: 12px; }
.time-row .field { flex: 1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 16px;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

/* Login */
body.login-page {
  min-height: 100vh;
  background: radial-gradient(circle at 50% -10%, #e6f6ee 0%, var(--bg) 55%);
  display: flex;
}

.login-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 32px -8px rgba(15, 17, 21, 0.12), 0 2px 8px rgba(15, 17, 21, 0.04);
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card h1 {
  font-size: 19px;
  margin: 0 0 6px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 26px;
  line-height: 1.4;
}

.login-card form {
  text-align: left;
}

.login-card button.primary {
  margin-top: 4px;
  padding: 10px 14px;
}
