/* =========================================================
   SISTEM PEMBAGIAN TIM KERJA HARIAN
   Gaya: minimalist strategic command center
   Font: Plus Jakarta Sans | Icon: SVG stroke tipis
========================================================= */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-alt: #f4f4f3;
  --border: #e6e6e4;
  --border-strong: #d8d8d5;
  --ink: #1c1c1e;
  --ink-soft: #55555a;
  --ink-faint: #8a8a8f;
  --navy: #10182b;
  --accent: #2f6fed;
  --accent-soft: #eaf1fe;
  --success: #1f8a5f;
  --success-soft: #e8f6ef;
  --warning: #b3760a;
  --warning-soft: #fdf3e1;
  --danger: #c8402c;
  --danger-soft: #fbebe8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20,20,25,0.04);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 28px; height: 28px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy);
  color: #d9dce6;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 13.5px; color: #fff; font-weight: 700; }
.brand-text span { font-size: 11.5px; color: #8b93a8; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #b6bcca; font-size: 13.5px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.nav-item .icon { color: #7c839a; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item:hover .icon { color: #cfd3e0; }
.nav-item.active { background: rgba(47,111,237,0.18); color: #fff; }
.nav-item.active .icon { color: var(--accent); }

.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #263049; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.user-meta strong { font-size: 12.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: #8b93a8; }
.logout-link { color: #b6bcca; }

.sidebar-overlay { display: none; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 17px; font-weight: 700; margin: 0; flex: 1; letter-spacing: -0.2px; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-soft);
}
.icon-btn:hover { background: var(--surface-alt); }
.only-mobile { display: none; }

.content { padding: 24px 28px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------- Alerts / flash ---------- */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500; margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: #cdeadd; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f3d3cc; }
.alert .icon { color: inherit; }

/* ---------- Context bar ---------- */
.context-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 22px;
}
.context-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  flex: 1 1 150px; min-width: 140px;
}
.context-card .label { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.context-card .value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.4px; }
.context-card .sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.context-card.accent { border-color: #cddcfb; background: var(--accent-soft); }
.context-card.warn { border-color: #f2ddb0; background: var(--warning-soft); }

/* ---------- Attention Required ---------- */
.attention-block {
  border: 1px solid #f2ddb0; background: var(--warning-soft);
  border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 22px;
}
.attention-block h3 { margin: 0 0 10px; font-size: 13.5px; color: var(--warning); display: flex; align-items: center; gap: 8px; }
.attention-block ul { margin: 0; padding-left: 18px; }
.attention-block li { font-size: 13px; color: #6b4c0f; margin-bottom: 4px; }
.attention-ok {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid #cdeadd; background: var(--success-soft);
  border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 22px;
  color: var(--success); font-size: 13.5px; font-weight: 600;
}

/* ---------- Section / card ---------- */
.section { margin-bottom: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.section-head .hint { font-size: 12.5px; color: var(--ink-faint); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2860d1; }
.btn-danger { background: var(--surface); border-color: #f0c7bc; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=search],
select, textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13.5px; color: var(--ink); outline: none;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ---------- Table (list) ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: var(--surface-alt); }

/* ---------- Badge / status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-neutral { background: var(--surface-alt); color: var(--ink-soft); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center; padding: 50px 20px; color: var(--ink-faint);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
}
.empty-state .icon-lg { margin: 0 auto 12px; color: var(--ink-faint); }
.empty-state p { margin: 0 0 14px; font-size: 13.5px; }

/* ---------- Team card (Pembagian Tim) ---------- */
.team-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.team-toolbar .date-nav { display: flex; align-items: center; gap: 6px; }
.spacer { flex: 1; }

.team-list { display: flex; flex-direction: column; gap: 12px; }
.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.team-card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer;
}
.team-card-head .team-index { font-size: 12px; font-weight: 700; color: var(--ink-faint); min-width: 46px; }
.team-card-head .team-name { font-weight: 700; font-size: 14px; }
.team-card-head .team-meta { display: flex; gap: 14px; color: var(--ink-soft); font-size: 12.5px; flex-wrap: wrap; }
.team-card-head .team-meta span { display: flex; align-items: center; gap: 5px; }
.team-card-head .team-meta .icon { color: var(--ink-faint); }
.team-card-head .chev { margin-left: auto; color: var(--ink-faint); transition: transform .15s ease; }
.team-card.open .chev { transform: rotate(180deg); }
.team-card-body { display: none; border-top: 1px solid var(--border); padding: 18px; background: var(--surface-alt); }
.team-card.open .team-card-body { display: block; }

.team-body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tb-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.tb-block h4 { margin: 0 0 10px; font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.3px; }
.member-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 12.5px;
}
.member-chip button { border: none; background: none; cursor: pointer; color: var(--ink-faint); display: flex; padding: 3px; border-radius: 50%; }
.member-chip button:hover { background: var(--danger-soft); color: var(--danger); }
.equipment-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.equipment-line:last-child { border-bottom: none; }
.equipment-line .req-required { color: var(--danger); font-weight: 600; }

/* ---------- Dropdown search (searchable select) ---------- */
.combo { position: relative; }
.combo-input { display: flex; align-items: center; gap: 8px; }
.combo-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(20,20,30,0.12); max-height: 220px; overflow-y: auto; display: none;
}
.combo-panel.open { display: block; }
.combo-option { padding: 9px 12px; font-size: 13px; cursor: pointer; display: flex; justify-content: space-between; }
.combo-option:hover, .combo-option.highlighted { background: var(--accent-soft); }
.combo-empty { padding: 12px; font-size: 12.5px; color: var(--ink-faint); text-align: center; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,17,26,0.42);
  display: none; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(10,12,20,0.25); }
.modal-box.wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* ---------- Command palette ---------- */
.cmdk-overlay { position: fixed; inset: 0; background: rgba(15,17,26,0.4); display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 200; }
.cmdk-overlay.open { display: flex; }
.cmdk-box { width: 100%; max-width: 560px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 24px 70px rgba(10,12,20,0.3); overflow: hidden; }
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk-input-wrap .icon { color: var(--ink-faint); }
.cmdk-input-wrap input { border: none; outline: none; flex: 1; font-size: 14.5px; }
.cmdk-results { max-height: 48vh; overflow-y: auto; }
.cmdk-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; cursor: pointer; font-size: 13.5px; }
.cmdk-item:hover, .cmdk-item.highlighted { background: var(--accent-soft); }
.cmdk-item .tag { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; }
.cmdk-empty { padding: 20px; text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast {
  background: var(--navy); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: 0 8px 24px rgba(10,12,20,0.25);
  display: flex; align-items: center; gap: 8px; animation: toast-in .18s ease;
}
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px);} to { opacity:1; transform:none; } }

/* ---------- Report page ---------- */
.report-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.report-toggle button { flex: 1; }
.report-preview {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 20px; white-space: pre-wrap; font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 12.8px; line-height: 1.6; color: var(--ink);
}
.report-options { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 16px; }

/* ---------- Password field with toggle ---------- */
.input-icon-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, background .15s ease;
}
.input-icon-field:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-icon-field > svg:first-child {
  flex-shrink: 0;
  margin-left: 13px;
  color: var(--ink-faint);
  pointer-events: none;
}
.input-icon-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding-left: 10px;
}
.input-icon-field input:focus {
  border: none;
  box-shadow: none;
}
.password-toggle {
  flex-shrink: 0;
  margin-right: 6px;
  width: 30px; height: 30px; border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); border-radius: 8px;
}
.password-toggle:hover { background: rgba(0,0,0,0.06); color: var(--ink-soft); }
.password-toggle:focus { outline: none; background: rgba(0,0,0,0.06); }

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #10182b 0%, #161f38 55%, #1b2542 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 38px 36px 32px;
  width: 100%;
  max-width: 396px;
  box-shadow: 0 30px 70px rgba(6, 8, 16, 0.45), 0 2px 4px rgba(6,8,16,0.08);
  border: 1px solid rgba(255,255,255,0.06);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-brand .brand-mark {
  width: 40px; height: 40px; font-size: 13px;
  box-shadow: 0 6px 14px rgba(47,111,237,0.35);
}
.login-brand strong { font-size: 14.5px; letter-spacing: -0.1px; }
.login-title { font-size: 20px; font-weight: 800; margin: 0 0 5px; letter-spacing: -0.3px; }
.login-sub { font-size: 12.8px; color: var(--ink-faint); margin: 0 0 26px; line-height: 1.5; }
.login-card .form-row { margin-bottom: 16px; }
.login-card .form-row label { font-size: 12px; }
.login-card input[type=text],
.login-card input[type=password] {
  padding-top: 11px; padding-bottom: 11px;
  border-radius: 10px;
  border-color: var(--border);
  background: var(--surface-alt);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.login-card input[type=text]:focus,
.login-card input[type=password]:focus {
  background: var(--surface);
  border-color: var(--accent);
}
.login-card .btn-primary {
  margin-top: 6px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(47,111,237,0.28);
}
.login-card .alert { margin-bottom: 18px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .team-toolbar, .report-toggle, .report-options, .btn, .toast-stack { display: none !important; }
  .content { padding: 0; max-width: 100%; }
  .report-preview { border: none; padding: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr; }
  .team-body-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .sidebar {
    position: fixed; left: -272px; top: 0; height: 100vh; z-index: 60;
    transition: left .2s ease; width: 260px;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(10,12,18,0.4); z-index: 50;
  }
  .sidebar-overlay.open { display: block; }
  .only-mobile { display: flex; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 14px 16px; }
  .context-bar { gap: 8px; }
  .context-card { flex: 1 1 45%; min-width: 0; padding: 12px; }
  .context-card .value { font-size: 18px; }
  table.list { font-size: 12.5px; }
  .modal-box { max-width: 100%; }
}
