:root {
  --bg: #f3f4fb;
  --bg-accent: radial-gradient(circle at 10% -10%, #eef0ff 0%, rgba(238,240,255,0) 45%),
               radial-gradient(circle at 100% 0%, #fdf2ff 0%, rgba(253,242,255,0) 40%);
  --card: #ffffff;
  --text: #15171f;
  --muted: #68708a;
  --border: #e7e8f2;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --danger: #e11d48;
  --danger-soft: #fee2e8;
  --success: #059669;
  --success-soft: #dcfce9;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(23, 24, 45, 0.04), 0 1px 1px rgba(23, 24, 45, 0.03);
  --shadow-md: 0 8px 24px -8px rgba(31, 33, 74, 0.16), 0 2px 6px -2px rgba(31, 33, 74, 0.08);
  --shadow-lg: 0 20px 45px -16px rgba(31, 33, 74, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-accent), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Topbar ---------------- */
.topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand {
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; background: #f6f6fc; padding: 4px; border-radius: var(--radius-pill); }
.topbar nav a {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  transition: background 0.15s ease, color 0.15s ease;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; background: #ffffff; }
.topbar nav a.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 10px -3px rgba(79, 70, 229, 0.55); }

/* Grouped dropdown nav items (futuristic/simplified menu) */
.topbar nav .nav-group { position: relative; }
.topbar nav .nav-group > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.topbar nav .nav-group > summary::-webkit-details-marker { display: none; }
.topbar nav .nav-group > summary::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  opacity: 0.6;
  transition: transform 0.15s ease;
}
.topbar nav .nav-group[open] > summary::after { transform: rotate(-135deg) translateY(1px); }
.topbar nav .nav-group > summary:hover { color: var(--text); background: #ffffff; }
.topbar nav .nav-group > summary.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 10px -3px rgba(79, 70, 229, 0.55); }
.topbar nav .nav-group[open] > summary:not(.active) { background: #ffffff; color: var(--text); }
.topbar nav .nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 190px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: nav-dropdown-in 0.15s ease;
}
@keyframes nav-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.topbar nav .nav-dropdown a {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.topbar nav .nav-dropdown a:hover { background: var(--primary-soft); text-decoration: none; }
.topbar nav .nav-dropdown a.active { background: var(--primary-soft); color: var(--primary); }
.topbar nav a.nav-icon { font-size: 1rem; padding: 7px 11px; line-height: 1; }
.topbar .userbox { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 10px; }

/* ---------------- Layout ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.container.narrow { max-width: 480px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 18px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

h1 { font-size: 1.45rem; margin: 0 0 16px; letter-spacing: -0.01em; font-weight: 800; }
h2 { font-size: 1.1rem; margin: 0 0 12px; font-weight: 700; }
h3 { font-weight: 700; }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------------- Stat tiles ---------------- */
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.stat .num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.stat .label { color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; background: #fafafe; }
th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafe; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 18px -6px rgba(79, 70, 229, 0.6); }
.btn:active { transform: translateY(0); box-shadow: 0 3px 8px -4px rgba(79, 70, 229, 0.55); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: #f7f7fc; box-shadow: var(--shadow-sm); }
.btn.danger { background: linear-gradient(135deg, var(--danger), #be123c); box-shadow: 0 4px 12px -4px rgba(225, 29, 72, 0.5); }
.btn.small { padding: 6px 12px; font-size: 0.8rem; }

/* ---------------- Forms ---------------- */
form .field { margin-bottom: 14px; }
label { display: block; font-size: 0.83rem; margin-bottom: 6px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: var(--radius-pill); font-size: 0.74rem; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge.ok { background: var(--success-soft); color: #15803d; }
.badge.warn { background: var(--warn-soft); color: #92400e; }
.badge.bad { background: var(--danger-soft); color: #9f1239; }
.badge.muted { background: #f1f1f8; color: #4b5166; }

/* ---------------- Flash messages ---------------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.9rem; border-left: 4px solid transparent; font-weight: 500; }
.flash.error { background: var(--danger-soft); color: #9f1239; border-left-color: var(--danger); }
.flash.success { background: var(--success-soft); color: #15803d; border-left-color: var(--success); }
.flash.warn { background: var(--warn-soft); color: #92400e; border-left-color: var(--warn); }

/* ---------------- Modal popup (pengingat, dsb) ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 23, 31, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-box h2 { margin: 0 24px 8px 0; font-size: 1.1rem; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.modal-order-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
}

/* ---------------- Login ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); }
.login-card h1 { text-align: center; }

/* ---------------- Check-in / tap-absen ---------------- */
.checkin-box { text-align: center; padding: 30px 24px; }
.checkin-box .date { color: var(--muted); margin-bottom: 20px; font-weight: 600; font-size: 0.9rem; }
.checkin-box .time { font-size: 2.2rem; font-weight: 700; margin: 10px 0; }

.tap-circle-wrap { display: flex; justify-content: center; margin: 6px 0 22px; }
.tap-circle {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 16px 32px -12px rgba(79, 70, 229, 0.55), 0 0 0 8px var(--primary-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tap-circle:hover { transform: scale(1.03); box-shadow: 0 20px 38px -12px rgba(79, 70, 229, 0.6), 0 0 0 8px var(--primary-soft); }
.tap-circle:active { transform: scale(0.98); }
.tap-circle .tap-icon { font-size: 1.7rem; line-height: 1; }
.tap-circle .tap-label { font-size: 0.95rem; font-weight: 700; }
.tap-circle .tap-sub { font-size: 0.68rem; opacity: 0.85; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.tap-circle:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.chip-field { text-align: left; margin-bottom: 18px; }
.chip-field > label { text-align: left; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-group input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-group label.chip {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  margin-bottom: 0;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.chip-group input[type="radio"]:checked + label.chip {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, 0.55);
}
.chip-group input[type="radio"]:disabled + label.chip { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.chip-group input[type="radio"]:focus-visible + label.chip { outline: 2px solid var(--primary); outline-offset: 2px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Kartu "siapa lagi shift" per toko di Dashboard */
.store-card { display: flex; flex-direction: column; }
.store-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.store-card-head h3 { margin: 0; font-size: 1.02rem; }
.store-empty { color: var(--muted); font-size: 0.85rem; padding: 8px 0; }
.shift-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.shift-item { display: flex; align-items: center; gap: 10px; }
.shift-item .avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
}
.shift-info { flex: 1; min-width: 0; }
.shift-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-meta { color: var(--muted); font-size: 0.8rem; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Preview isi kontrak (portal karyawan) sebelum tanda tangan */
.contract-preview {
  background: #fafafe;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
  max-height: 420px;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}
.contract-preview h4 { margin: 14px 0 6px; font-size: 0.95rem; }
.contract-preview h4:first-child { margin-top: 0; }
.contract-preview ol { margin: 0 0 0 1.1em; padding: 0; }
.contract-preview li { margin-bottom: 6px; }
.contract-preview .note { font-style: italic; color: var(--muted); margin-top: 6px; }
details.contract-preview-toggle summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: 0.9rem; list-style: none; }
details.contract-preview-toggle summary::-webkit-details-marker { display: none; }
details.contract-preview-toggle summary::before { content: "▸ "; }
details.contract-preview-toggle[open] summary::before { content: "▾ "; }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .container { padding: 18px 14px 50px; }
  .card { padding: 18px; border-radius: 14px; }
}

@media print {
  .topbar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
