/* SIPENA — Minimal UI
   Tanpa Tailwind build: semua utility yang dipakai didefinisikan di sini.
*/

@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
  --color-primary: #0D9488;
  --color-primary-light: #2DD4BF;
  --color-accent: #D97706;
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-foreground: #134E4A;
  --color-muted: #64748B;
  --color-border: #E2E8F0;
  --color-success: #16A34A;
  --color-warning: #D97706;
  --color-destructive: #DC2626;
  --color-ring: #0D9488;
  --radius: 8px;
  --shadow-soft: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.06);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Fira Sans', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--color-background);
  color: var(--color-foreground);
  -webkit-font-smoothing: antialiased;
}

/* ---- SVG icons: ukuran tetap & konsisten ---- */
svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
svg.icon-xs, .icon-xs { width: 14px; height: 14px; }
svg.icon-sm, .icon-sm, .btn svg, nav a svg, .stat-card svg {
  width: 16px;
  height: 16px;
}
svg.icon-md, .icon-md { width: 18px; height: 18px; }
svg.icon-lg, .icon-lg { width: 20px; height: 20px; }

/* Override class Tailwind-like yang sering dipakai di HTML */
.w-4, .w-4.h-4 { width: 14px !important; height: 14px !important; }
.w-5, .w-5.h-5 { width: 16px !important; height: 16px !important; }
.w-6, .w-6.h-6 { width: 18px !important; height: 18px !important; }
.w-8, .w-8.h-8 { width: 28px !important; height: 28px !important; }
.w-9, .w-9.h-9 { width: 32px !important; height: 32px !important; }
.w-10, .w-10.h-10 { width: 36px !important; height: 36px !important; }
.w-16, .w-16.h-16 { width: 48px !important; height: 48px !important; }
.w-20, .w-20.h-20 { width: 56px !important; height: 56px !important; }

.font-mono, .tabular-nums, [data-numeric] {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---- Layout helpers ---- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-0\.5 { gap: 0.125rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.min-h-screen { min-height: 100vh; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-xs { max-width: 20rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.25rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:block { display: block; }
  .sm\:w-auto { width: auto; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:flex-col { flex-direction: column; }
  .lg\:w-56 { width: 14rem; }
  .lg\:fixed { position: fixed; }
  .lg\:inset-y-0 { top: 0; bottom: 0; }
  .lg\:pl-56 { padding-left: 14rem; }
  .lg\:hidden { display: none !important; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.inset-x-0 { left: 0; right: 0; }
.inset-y-0 { top: 0; bottom: 0; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }

/* spacing */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.4rem; }
.p-3 { padding: 0.6rem; }
.p-4 { padding: 0.85rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.65rem; padding-right: 0.65rem; }
.px-4 { padding-left: 0.85rem; padding-right: 0.85rem; }
.px-5 { padding-left: 1rem; padding-right: 1rem; }
.px-8 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.4rem; padding-bottom: 0.4rem; }
.py-2\.5 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.py-4 { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.py-6 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-8 { padding-top: 1.75rem; padding-bottom: 1.75rem; }
.py-12 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pb-2 { padding-bottom: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.65rem; }
.mb-4 { margin-bottom: 0.85rem; }
.mb-6 { margin-bottom: 1.25rem; }
.mb-8 { margin-bottom: 1.75rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-4 { margin-top: 0.85rem; }
.ml-auto { margin-left: auto; }
.-ml-2 { margin-left: -0.5rem; }

/* typography */
.text-xs { font-size: 0.75rem; line-height: 1.3; }
.text-sm { font-size: 0.8125rem; line-height: 1.4; }
.text-base { font-size: 0.9375rem; }
.text-lg { font-size: 1.05rem; line-height: 1.35; }
.text-xl { font-size: 1.2rem; line-height: 1.3; }
.text-3xl { font-size: 1.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.6; }
.leading-snug { line-height: 1.4; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.tracking-tight { letter-spacing: -0.02em; }
.no-underline { text-decoration: none; }
.antialiased { -webkit-font-smoothing: antialiased; }

.bg-\[var\(--color-background\)\] { background-color: var(--color-background); }
.bg-\[var\(--color-surface\)\] { background-color: var(--color-surface); }
.bg-\[var\(--color-primary\)\] { background-color: var(--color-primary); }
.bg-\[var\(--color-surface\)\]\/90 { background-color: color-mix(in srgb, var(--color-surface) 90%, transparent); }
.bg-black\/40 { background-color: rgba(0,0,0,0.4); }
.text-\[var\(--color-foreground\)\] { color: var(--color-foreground); }
.text-\[var\(--color-muted\)\] { color: var(--color-muted); }
.text-\[var\(--color-primary\)\] { color: var(--color-primary); }
.text-\[var\(--color-destructive\)\] { color: var(--color-destructive); }
.text-\[var\(--color-success\)\] { color: var(--color-success); }
.text-\[var\(--color-warning\)\] { color: var(--color-warning); }
.text-\[var\(--color-accent\)\] { color: var(--color-accent); }
.text-white { color: #fff; }
.border-\[var\(--color-border\)\] { border-color: var(--color-border); }
.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.border-r { border-right-width: 1px; border-right-style: solid; }
.border-y { border-top-width: 1px; border-bottom-width: 1px; border-style: solid; }
.rounded-lg { border-radius: 6px; }
.rounded-xl { border-radius: var(--radius); }
.rounded-2xl { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }
.shadow-sm { box-shadow: var(--shadow-soft); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-xl { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.backdrop-blur { backdrop-filter: blur(8px); }
.object-cover { object-fit: cover; }
.cursor-pointer { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* ---- Buttons (lebih ringkas) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 150ms, filter 150ms, opacity 150ms;
  min-height: 34px;
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
}
.btn-outline:hover:not(:disabled) { background: var(--color-background); }
.btn-destructive { background: var(--color-destructive); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  min-width: 30px;
  min-height: 30px;
  padding: 0.3rem;
}
.btn-ghost:hover { background: var(--color-background); color: var(--color-foreground); }
.btn svg { width: 14px; height: 14px; }

/* ---- Card ---- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  padding: 0.85rem 1rem;
}

/* ---- Form ---- */
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--color-foreground);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-foreground);
  transition: border-color 150ms;
  min-height: 34px;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 18%, transparent);
}
.form-textarea { min-height: 72px; resize: vertical; }
.form-select { appearance: auto; }

/* ---- Table (padat) ---- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
table.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--color-background);
  font-weight: 600;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  font-size: 0.75rem;
}
table.data-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td {
  background: color-mix(in srgb, var(--color-primary) 3%, transparent);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 9999px;
}
.badge-hadir { background: #dcfce7; color: #166534; }
.badge-sakit { background: #fef3c7; color: #92400e; }
.badge-izin { background: #e0e7ff; color: #3730a3; }
.badge-alpa { background: #fee2e2; color: #991b1b; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--color-surface);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  max-width: 24rem;
  width: 100%;
  padding: 1.15rem;
  max-height: 90vh;
  overflow-y: auto;
}

/* Stat card — ringkas */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat-card .stat-value {
  font-family: 'Fira Code', monospace;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.15;
}
.stat-card .stat-label {
  font-size: 0.7rem;
  color: var(--color-muted);
}
.stat-card svg {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

/* Sidebar nav items */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 150ms, color 150ms;
}
.nav-link svg { width: 16px; height: 16px; }
.nav-link.active {
  background: var(--color-primary);
  color: #fff;
}
.nav-link:not(.active) {
  color: var(--color-muted);
}
.nav-link:not(.active):hover {
  background: var(--color-background);
  color: var(--color-foreground);
}

/* Bottom nav mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 52px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  font-size: 0.65rem;
  font-weight: 500;
  gap: 0.1rem;
  text-decoration: none;
  color: var(--color-muted);
}
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a svg { width: 18px; height: 18px; }

.safe-area-pb { padding-bottom: env(safe-area-inset-bottom, 0); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
[x-cloak] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tr {
    display: block;
    margin-bottom: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.55rem 0.7rem;
    background: var(--color-surface);
  }
  .table-responsive-cards td {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border: none;
    font-size: 0.8125rem;
  }
  .table-responsive-cards td::before {
    content: attr(data-label);
    font-weight: 500;
    color: var(--color-muted);
    margin-right: 0.75rem;
    font-size: 0.7rem;
  }
}

/* Sidebar width compact */
.sidebar-w { width: 14rem; }
.main-pl { padding-left: 0; }
@media (min-width: 1024px) {
  .main-pl { padding-left: 14rem; }
}


/* ===== Sidebar fix (tampilan desktop) ===== */
.sipena-sidebar {
  display: none;
  flex-direction: column;
  width: 220px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  z-index: 30;
}
.sipena-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
@media (min-width: 900px) {
  .sipena-sidebar {
    display: flex !important;
  }
  .sipena-main {
    padding-left: 220px;
  }
  .sipena-burger {
    display: none !important;
  }
  .bottom-nav {
    display: none !important;
  }
  .bottom-nav-spacer {
    display: none !important;
  }
}
@media (max-width: 899px) {
  .sipena-sidebar {
    display: none !important;
  }
}
