:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #0f62fe;
  --primary-hover: #0353e9;
  --in-bg: #dcfce7;
  --in-text: #166534;
  --out-bg: #fef3c7;
  --out-text: #92400e;
  --err-bg: #fee2e2;
  --err-text: #991b1b;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.app-shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 14px 14px 32px 14px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 16px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(15, 98, 254, 0.28);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.banner-warn {
  border-left: 4px solid #f59e0b;
}

.banner-warn h2 {
  margin: 0 0 6px 0;
  font-size: 17px;
}

.banner-warn p {
  margin: 0 0 14px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* Tabs */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #eef2f6;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.mode-tab {
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Inputs */
.filter-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-single {
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.filter-grid .field,
.filter-single .field {
  margin-bottom: 0;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.select-input,
.text-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.select-input:focus,
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.14);
}

/* Buttons */
.btn {
  height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: scale(0.99);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.summary-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.summary-hint {
  font-size: 12px;
  color: var(--muted);
}

/* List */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.list-header h2 {
  margin: 0;
  font-size: 16px;
}

.period-pill {
  font-size: 12px;
  font-weight: 600;
  background: #eef2ff;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 999px;
}

.day-group {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.day-group:first-child {
  border-top: none;
  padding-top: 2px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.day-subtotal {
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
}

.punch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: #f9fafb;
  border-radius: 9px;
  margin-bottom: 6px;
}

.punch-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.punch-time {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-in {
  background: var(--in-bg);
  color: var(--in-text);
}

.badge-out {
  background: var(--out-bg);
  color: var(--out-text);
}

.punch-note {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.empty-state {
  text-align: center;
  padding: 24px 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Status / Errors */
.status-msg {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  background: var(--err-bg);
  color: var(--err-text);
  font-weight: 500;
}

.error-inline {
  background: var(--err-bg);
  color: var(--err-text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  border: none;
  background: #f3f4f6;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  margin-top: 0;
}

.hidden {
  display: none !important;
}
