/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  margin: 0; padding: 0; width: 100%; overflow-x: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* =============================================
   HEADER
   ============================================= */
.app-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a3352 100%);
  color: #fff;
  padding: 0; margin: 0; width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  position: sticky; top: 0; left: 0; right: 0; z-index: 100;
}
.app-header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px 6px;
}
.app-title {
  font-size: 0.78rem; font-weight: 800; color: #ffffff;
  letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
}
.app-title-sub {
  font-size: 0.68rem; font-weight: 600; color: #93c5fd; letter-spacing: 0.04em;
}
.header-badge { display: flex; align-items: center; gap: 8px; }
.badge-online {
  display: flex; align-items: center; gap: 5px;
  background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3);
  border-radius: 20px; padding: 3px 10px;
  font-size: 0.65rem; font-weight: 700; color: #86efac;
}
.badge-dot {
  width: 6px; height: 6px; background: #22c55e; border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.header-time { font-size: 0.72rem; color: #93c5fd; font-weight: 600; font-variant-numeric: tabular-nums; }

/* =============================================
   TAB NAVIGATION
   ============================================= */
.tab-row {
  display: flex; gap: 0; align-items: flex-end; padding: 0 14px;
}
.tab-btn {
  flex: 0 0 auto; padding: 6px 18px; height: 34px; box-sizing: border-box;
  border-radius: 0; font-size: 0.72rem; font-weight: 700; cursor: pointer;
  border: none; border-bottom: 3px solid transparent; transition: all 0.15s;
  color: #93c5fd; background: transparent; letter-spacing: 0.05em;
  white-space: nowrap; display: flex; align-items: center; gap: 5px;
  text-transform: uppercase;
}
.tab-btn.active {
  background: rgba(255,255,255,0.12); color: #fff; border-bottom: 3px solid #38bdf8;
}
.tab-btn:not(.active):hover { background: rgba(255,255,255,0.10); color: #e0f2fe; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =============================================
   TOOLBAR
   ============================================= */
.toolbar-wrap {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06); padding: 7px 14px;
  position: sticky; top: 0; z-index: 90;
}
.toolbar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; max-width: 100%; margin: 0;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.toolbar-label {
  font-size: 0.72rem; font-weight: 700; color: #475569;
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em;
}
.toolbar-select {
  border: 1.5px solid #cbd5e1; border-radius: 7px; padding: 6px 10px;
  font-size: 0.72rem; color: #1e3a5f; background: #fff; cursor: pointer;
  transition: border 0.15s, box-shadow 0.15s; min-width: 0;
}
.toolbar-select:focus {
  outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.toolbar-input {
  border: 1.5px solid #cbd5e1; border-radius: 7px; padding: 6px 10px;
  font-size: 0.72rem; color: #1e3a5f; background: #fff;
  transition: border 0.15s, box-shadow 0.15s;
}
.toolbar-input:focus {
  outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.toolbar-sep { width: 1px; height: 24px; background: #e2e8f0; flex-shrink: 0; }
.toolbar-info { font-size: 0.72rem; color: #94a3b8; margin-left: auto; font-style: italic; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  padding: 7px 14px; border-radius: 7px; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; border: none; display: inline-flex; align-items: center;
  gap: 5px; transition: all 0.18s; white-space: nowrap; letter-spacing: 0.03em;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #1e3a5f; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-info { background: #0891b2; color: #fff; }
.btn-info:hover { background: #0e7490; }
.btn-outline { background: #fff; color: #1e3a5f; border: 1.5px solid #1e3a5f; }
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 5px 10px; font-size: 0.7rem; }
.btn-icon { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 7px; }

/* =============================================
   CONTENT AREA
   ============================================= */
.content-wrap {
  padding: 10px 12px; max-width: 100%; margin: 0;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border-radius: 10px; padding: 14px 16px;
  border: 1px solid #e2e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow 0.2s, transform 0.2s; cursor: default;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); transform: translateY(-1px); }
.stat-card-header { display: flex; align-items: center; justify-content: space-between; }
.stat-card-title {
  font-size: 0.68rem; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.stat-card-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.icon-blue   { background: #eff6ff; }
.icon-green  { background: #f0fdf4; }
.icon-yellow { background: #fffbeb; }
.icon-red    { background: #fef2f2; }
.icon-purple { background: #faf5ff; }
.icon-cyan   { background: #ecfeff; }
.icon-orange { background: #fff7ed; }
.stat-card-value {
  font-size: 1.5rem; font-weight: 800; color: #1e293b; line-height: 1;
}
.stat-card-value span {
  font-size: 0.7rem; font-weight: 600; color: #94a3b8; margin-left: 4px;
}
.stat-card-footer {
  font-size: 0.68rem; color: #94a3b8; display: flex; align-items: center; gap: 4px;
}
.stat-trend-up   { color: #16a34a; font-weight: 700; }
.stat-trend-down { color: #dc2626; font-weight: 700; }

/* =============================================
   TABLE HEADER BAR
   ============================================= */
.table-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 0 2px;
  flex-wrap: wrap; gap: 8px;
}

/* =============================================
   TABLE
   ============================================= */
.table-wrap {
  overflow-x: hidden; border-radius: 0;
  border: 1px solid #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  background: #fff; width: 100%;
}
.table-outer { margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; table-layout: fixed; }
thead th {
  position: sticky; top: 0; z-index: 20;
  background: #1e3a5f; color: #fff;
  font-size: 0.65rem; font-weight: 700;
  white-space: normal; word-break: break-word;
  padding: 8px 6px; border-right: 1px solid #2d5382;
  text-align: center; letter-spacing: 0.03em; text-transform: uppercase;
}
tbody td {
  padding: 5px 6px; border-right: 1px solid #e8ecf0;
  border-bottom: 1px solid #e8ecf0; text-align: center;
  font-size: 0.68rem; background: #fff; color: #374151;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
tbody tr:hover td { background: #f0f7ff !important; }
tbody tr:last-child td { border-bottom: none; }

/* =============================================
   BADGE / STATUS
   ============================================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-neutral { background: #f1f5f9; color: #64748b; }
.badge-purple  { background: #ede9fe; color: #6d28d9; }

/* =============================================
   CARD / PANEL
   ============================================= */
.card {
  background: #fff; border-radius: 10px; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06); overflow: hidden;
}
.card-header {
  padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  background: #f8fafc;
}
.card-title {
  font-size: 0.75rem; font-weight: 700; color: #1e3a5f;
  display: flex; align-items: center; gap: 6px;
}
.card-body { padding: 14px 16px; }

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar-wrap {
  width: 100%; background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-blue   { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.progress-green  { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-red    { background: linear-gradient(90deg, #dc2626, #f87171); }
.progress-yellow { background: linear-gradient(90deg, #d97706, #fbbf24); }

/* =============================================
   FORM
   ============================================= */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 0.7rem; font-weight: 700; color: #475569;
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px; border: 1.5px solid #cbd5e1;
  border-radius: 7px; font-size: 0.75rem; color: #1e293b; background: #fff;
  transition: border 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* =============================================
   MODAL
   ============================================= */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(2px); animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden;
  display: flex; flex-direction: column; animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 14px 20px; background: #1e3a5f; color: #fff;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.modal-close {
  background: rgba(255,255,255,0.15); border: none; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.25); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px; background: #f8fafc; border-top: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0;
}

/* =============================================
   TOAST
   ============================================= */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-size: 0.72rem; font-weight: 600; color: #fff;
  min-width: 220px; max-width: 360px; animation: toastIn 0.25s ease; pointer-events: auto;
}
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #0891b2; }
.toast-warning { background: #d97706; }

/* =============================================
   SPINNER / LOADING
   ============================================= */
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2.5px solid #e2e8f0; border-top-color: #3b82f6;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 60px 20px; color: #64748b; font-size: 0.75rem;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center; gap: 10px;
}
.empty-title { font-size: 0.85rem; font-weight: 700; color: #64748b; }
.empty-desc  { font-size: 0.72rem; color: #94a3b8; max-width: 280px; }

/* =============================================
   SEARCH INPUT
   ============================================= */
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 0.75rem; pointer-events: none;
}
.search-input {
  padding: 7px 10px 7px 32px; border: 1.5px solid #cbd5e1; border-radius: 7px;
  font-size: 0.72rem; color: #1e293b; width: 200px; background: #fff;
  transition: border 0.15s, box-shadow 0.15s, width 0.2s;
}
.search-input:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12); width: 240px;
}

/* =============================================
   PROGRESS UNIT CARD (Jadwal / Progres tab)
   ============================================= */
.unit-progress-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.unit-card {
  background: #fff; border-radius: 10px; border: 1px solid #e2e8f0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06); padding: 14px 16px;
}
.unit-card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.unit-card-name { font-size: 0.75rem; font-weight: 700; color: #1e3a5f; }
.unit-card-pct  { font-size: 0.75rem; font-weight: 800; color: #2563eb; }
.unit-progress-items { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.unit-progress-item { display: flex; align-items: center; gap: 8px; }
.unit-progress-label { font-size: 0.68rem; color: #64748b; width: 100px; flex-shrink: 0; }
.unit-progress-bar-wrap { flex: 1; background: #e2e8f0; border-radius: 4px; height: 7px; overflow: hidden; }
.unit-progress-val { font-size: 0.68rem; font-weight: 700; color: #374151; width: 28px; text-align: right; flex-shrink: 0; }

/* =============================================
   HISTORI TIMELINE
   ============================================= */
.histori-list { display: flex; flex-direction: column; gap: 0; }
.histori-item {
  display: flex; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9; transition: background 0.15s;
}
.histori-item:hover { background: #f8fafc; }
.histori-dot-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
.histori-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px;
}
.histori-line { width: 2px; background: #e2e8f0; flex: 1; min-height: 20px; }
.histori-content { flex: 1; }
.histori-title { font-size: 0.75rem; font-weight: 700; color: #1e293b; margin-bottom: 2px; }
.histori-meta  { font-size: 0.68rem; color: #94a3b8; display: flex; gap: 10px; flex-wrap: wrap; }
.histori-meta span { display: flex; align-items: center; gap: 3px; }

/* =============================================
   TAG
   ============================================= */
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 4px; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.tag-blue   { background: #dbeafe; color: #1d4ed8; }
.tag-green  { background: #dcfce7; color: #15803d; }
.tag-red    { background: #fee2e2; color: #b91c1c; }
.tag-yellow { background: #fef9c3; color: #92400e; }
.tag-gray   { background: #f1f5f9; color: #475569; }
.tag-purple { background: #ede9fe; color: #6d28d9; }

/* =============================================
   ACTION BUTTONS IN TABLE
   ============================================= */
.tbl-action-wrap { display: flex; gap: 4px; justify-content: center; }

/* =============================================
   TOOLBAR TAB BUTTONS
   ============================================= */
.active-tab-btn {
  background: #1e3a5f !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #38bdf8;
}
.inactive-tab-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #cbd5e1;
}
.inactive-tab-btn:hover {
  background: #e2e8f0;
  color: #1e3a5f;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .unit-progress-grid { grid-template-columns: 1fr; }
  .tab-btn { padding: 6px 10px; font-size: 0.65rem; }
  .app-title-sub { display: none; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-info { display: none; }
}
