/* ==============================================================
   ProWorks OS Design System — by ihsanLabs
   ============================================================== */

/* ---- FONTS & RESET ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #0f172a;
  --bg-card: #1e293b;
  --bg-card2: #243044;
  --bg-input: #0f172a;
  --border: #334155;
  --border-light: #475569;
  --primary: #f59e0b;
  --primary-dark: #d97706;
  --primary-glow: rgba(245, 158, 11, 0.15);
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xl: 20px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s ease;
  --header-h: 60px;
  --bottomnav-h: 68px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

input,
select,
textarea,
button {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ---- SCREENS ---- */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

#screen-login.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f1f3d 100%);
}

.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
}

.blob1 {
  width: 400px;
  height: 400px;
  background: #f59e0b;
  top: -100px;
  right: -100px;
}

.blob2 {
  width: 300px;
  height: 300px;
  background: #3b82f6;
  bottom: -80px;
  left: -80px;
}

.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.login-logo {
  text-align: center;
}

.logo-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.6));
  margin-bottom: 8px;
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: #fff;
}

.logo-title span {
  color: var(--primary);
}

.logo-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.role-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
  gap: 4px;
}

.role-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.role-btn.active {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}

.role-icon {
  font-size: 1.6rem;
}

.role-name {
  font-size: 0.72rem;
  font-weight: 700;
}

.role-desc {
  font-size: 0.65rem;
  color: inherit;
  opacity: 0.7;
}

.pass-input-wrap {
  position: relative;
}

.pass-input-wrap .form-input {
  padding-right: 46px;
}

.pass-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
}

.pass-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 6px;
}

.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--accent-red);
}

.login-footer {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-align: center;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
#screen-app {
  flex-direction: column;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-select-container {
  margin-left: 8px;
}

#header-project-select {
  background: var(--bg-card2);
  border: 1px solid var(--border-light);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  max-width: 140px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: var(--transition);
}

#header-project-select:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 1rem;
}

.brand-icon {
  font-size: 1.3rem;
}

.user-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 3px 10px;
}

/* Sidebar */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 299;
  background: rgba(0, 0, 0, 0.6);
  display: none;
}

.sidebar-overlay.visible {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 300;
  width: 270px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-user {}

.sidebar-user .user-role-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
}

.sidebar-user .user-name {
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-user .user-role {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border-left: 3px solid transparent;
}

.sidebar-item:hover {
  background: var(--bg-card2);
  color: var(--text);
}

.sidebar-item.active {
  color: var(--primary);
  background: var(--primary-glow);
  border-left-color: var(--primary);
}

.sidebar-item .nav-icon {
  font-size: 1.2rem;
  min-width: 24px;
  text-align: center;
}

.sidebar-item .nav-label {
  font-size: 0.9rem;
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.sidebar-brand {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  padding: 8px;
}

.logout-item {
  color: var(--accent-red) !important;
}

/* Main Content */
.app-main {
  margin-top: var(--header-h);
  padding-bottom: calc(var(--bottomnav-h) + 16px);
  min-height: calc(100vh - var(--header-h));
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--bottomnav-h);
  background: rgba(30, 41, 59, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  min-width: 50px;
  border: none;
  background: none;
  text-align: center;
}

.bottom-nav-item .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.bottom-nav-item:hover {
  color: var(--primary);
}

.bottom-nav-item.active {
  color: var(--primary);
}

/* ============================================================
   PAGES
   ============================================================ */
.page {
  display: none;
  padding: 20px 16px;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 800;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   CARDS & GRIDS
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-icon {
  font-size: 2rem;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1rem;
  font-weight: 800;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-blue {
  border-color: rgba(59, 130, 246, 0.4);
}

.card-blue .card-value {
  color: var(--accent-blue);
}

.card-amber {
  border-color: rgba(245, 158, 11, 0.4);
}

.card-amber .card-value {
  color: var(--primary);
}

.card-green {
  border-color: rgba(16, 185, 129, 0.4);
}

.card-green .card-value {
  color: var(--accent-green);
}

.card-purple {
  border-color: rgba(139, 92, 246, 0.4);
}

.card-purple .card-value {
  color: var(--accent-purple);
}

/* SECTION CARD */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--primary);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-card2);
  color: var(--text);
}

.btn-full {
  width: 100%;
}

.btn-xl {
  padding: 16px 24px;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2394a3b8' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar label {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-bar .form-select {
  flex: 1;
  min-width: 180px;
}

/* ============================================================
   LIST ITEMS
   ============================================================ */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
}

.list-item:hover {
  border-color: var(--border-light);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.list-item-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.list-item-date {
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.list-item-body {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.list-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* BADGE */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary);
}

.badge-red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.badge-purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
}

/* PROGRESS BAR */
.progress-wrap {
  margin: 8px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.progress-bar {
  height: 10px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, #fbbf24 100%);
  transition: width 0.5s ease;
}

.progress-fill.green {
  background: linear-gradient(90deg, var(--accent-green), #34d399);
}

.progress-fill.red {
  background: linear-gradient(90deg, var(--accent-red), #f87171);
}

/* ============================================================
   DASHBOARD SPECIFIC
   ============================================================ */
.alert-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-action-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
  transform: translateY(-2px);
}

.quick-action-btn .qa-icon {
  font-size: 1.8rem;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
  cursor: pointer;
}

.project-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.project-name {
  font-size: 1rem;
  font-weight: 700;
}

.project-client {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.project-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 8px;
}

.project-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   ABSENSI & PAYROLL
   ============================================================ */
.payroll-calc-box {
  background: var(--primary-glow);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.9rem;
  margin: 8px 0;
}

.summary-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}

.summary-box-item {}

.summary-box-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
}

.summary-box-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   KEUANGAN / CASHFLOW
   ============================================================ */
.cashflow-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.cf-sum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.cf-sum-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.cf-sum-val {
  font-size: 1rem;
  font-weight: 800;
  margin-top: 4px;
}

.cf-sum-in .cf-sum-val {
  color: var(--accent-green);
}

.cf-sum-out .cf-sum-val {
  color: var(--accent-red);
}

.cf-sum-net .cf-sum-val {
  color: var(--primary);
}

.category-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.cat-bar-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.cat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.cat-bar-header .cat-warn {
  color: var(--accent-red);
  font-weight: 700;
}

.trx-in {
  border-left: 3px solid var(--accent-green);
}

.trx-out {
  border-left: 3px solid var(--accent-red);
}

/* TYPE SELECTOR */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.type-btn {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.type-btn.active[data-type="masuk"] {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
}

.type-btn.active[data-type="keluar"] {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

/* ============================================================
   PIUTANG
   ============================================================ */
.piutang-item {}

.piutang-overdue {
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* ============================================================
   LAPORAN HARIAN
   ============================================================ */
.weather-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.weather-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.weather-btn.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.photo-upload-area:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.photo-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.hint-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.photos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.photo-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}

.items-progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.item-progress-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.item-progress-row input.form-input {
  flex: 1;
  padding: 8px 10px;
}

.item-progress-row input[type=number] {
  width: 80px;
  flex: none;
}

.item-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   RECEIPT
   ============================================================ */
.receipt-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  color: #333;
  font-size: 0.85rem;
  line-height: 1.7;
  border: 1px solid var(--border);
}

.receipt-header {
  text-align: center;
  margin-bottom: 16px;
}

.receipt-header h3 {
  font-size: 1.3rem;
  font-weight: 900;
  color: #f59e0b;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.receipt-row.total {
  border-top: 2px solid #333;
  margin-top: 8px;
  font-weight: 800;
  font-size: 1rem;
}

.receipt-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.75rem;
  color: #999;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: 16px;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  margin: auto;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 640px;
}

.modal-small {
  max-width: 340px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--bg-card2);
}

.modal-body {
  overflow-y: auto;
  padding: 20px 24px;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   TUTORIAL MODULE
   ============================================================ */
.tutorial-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tutorial-tab-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.tutorial-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tutorial-tab-btn.active {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}

.tutorial-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tutorial-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tutorial-step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card2);
  cursor: pointer;
}

.tutorial-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-glow);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tutorial-step-title {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}

.tutorial-step-icon {
  font-size: 1.5rem;
}

.tutorial-step-body {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.tutorial-tip {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--accent-blue);
}

.tutorial-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--primary);
}

.tutorial-steps-ol {
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutorial-steps-ol li {
  counter-increment: step-counter;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.6;
}

.tutorial-steps-ol li::before {
  content: counter(step-counter);
  background: var(--primary);
  color: #000;
  font-weight: 800;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.tutorial-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tutorial-feature-item {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.82rem;
}

.tutorial-feature-item .fi-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.tutorial-feature-item .fi-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.tutorial-feature-item .fi-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ============================================================
   REPORT PAGE
   ============================================================ */
.report-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.pl-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.pl-row:last-child {
  border-bottom: none;
  font-weight: 800;
  font-size: 1rem;
}

.pl-positive {
  color: var(--accent-green);
}

.pl-negative {
  color: var(--accent-red);
}

/* ============================================================
   UTILITY
   ============================================================ */
.empty-state {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  padding: 32px 16px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.text-green {
  color: var(--accent-green);
  font-weight: 700;
}

.text-red {
  color: var(--accent-red);
  font-weight: 700;
}

.text-amber {
  color: var(--primary);
  font-weight: 700;
}

.text-muted {
  color: var(--text-muted);
}

.text-right {
  text-align: right;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-gap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  display: none;
  position: fixed;
  bottom: calc(var(--bottomnav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  animation: slideUp 0.3s ease;
}

.toast.show {
  display: block;
}

.toast.success {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.toast.error {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* ==================== NEW COMPONENTS ==================== */
.report-view-toggle {
  display: flex;
  background: var(--bg-card2);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.btn-toggle {
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-toggle.active {
  background: var(--primary);
  color: #000;
}

.form-group-check {
  margin-bottom: 12px;
}

.form-group-check label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.form-group-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.tutorial-steps-ol {
  margin-top: 12px;
  padding-left: 20px;
}

.tutorial-steps-ol li {
  margin-bottom: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.tutorial-steps-ol code {
  background: var(--bg-card2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary);
  font-family: monospace;
}

@keyframes slideUp {
  from {
    bottom: var(--bottomnav-h);
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ============================================================
   PWA BANNER
   ============================================================ */
.pwa-banner {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 199;
  background: var(--primary);
  color: #000;
  padding: 10px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-banner span {
  flex: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }

  .cashflow-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
    position: fixed;
  }

  .app-main {
    margin-left: 270px;
  }

  .app-header {
    left: 270px;
  }

  #btn-menu {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .bottom-nav {
    left: 270px;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .receipt-box,
  .receipt-box * {
    visibility: visible;
  }

  .receipt-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}