/* ====== CSS VARIABLES ====== */
:root {
  --primary: #00b4d8;
  --primary-dark: #0077b6;
  --primary-glow: rgba(0,180,216,0.25);
  --accent: #f77f00;
  --danger: #e63946;
  --success: #2a9d8f;
  --warning: #e9c46a;

  --bg: #070d1a;
  --bg2: #0d1526;
  --bg3: #111e35;
  --surface: #0f1c32;
  --surface2: #152238;
  --border: rgba(0,180,216,0.15);
  --border2: rgba(255,255,255,0.06);

  --text: #e8f4fc;
  --text-muted: #7a9bb5;
  --text-dim: #4a6a85;

  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ====== AUTH PAGE ====== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
}

.auth-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.bg-circle {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.12;
}
.c1 { width:500px; height:500px; background:var(--primary); top:-100px; right:-100px; }
.c2 { width:400px; height:400px; background:var(--primary-dark); bottom:-80px; left:-80px; }
.c3 { width:300px; height:300px; background:var(--accent); top:50%; left:50%; transform:translate(-50%,-50%); }

.auth-container {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 440px;
  box-shadow: var(--shadow), 0 0 60px rgba(0,180,216,0.08);
  animation: slideUp 0.5s ease;
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(30px); }
  to { opacity:1; transform:translateY(0); }
}

.auth-brand {
  text-align: center; margin-bottom: 1.5rem;
}
.brand-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; font-size: 2rem;
  box-shadow: 0 8px 24px var(--primary-glow);
}
.brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem; font-weight: 800;
  letter-spacing: 2px; color: var(--text);
}
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

.auth-tabs {
  display: flex; gap: 0; margin-bottom: 1.5rem;
  background: var(--bg2); border-radius: var(--radius-sm);
  padding: 4px;
}
.tab-btn {
  flex: 1; padding: 0.6rem; border: none; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border-radius: 6px; font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--primary); color: white; font-weight: 600;
}

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.auth-form h2 {
  font-family: 'Syne', sans-serif; font-weight: 700;
  font-size: 1.3rem; margin-bottom: 0.3rem;
}
.form-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

.input-group {
  margin-bottom: 1rem;
}
.input-group label {
  display: block; font-size: 0.8rem; color: var(--text-muted);
  margin-bottom: 0.4rem; font-weight: 500;
}
.input-group input,
.input-group select {
  width: 100%; padding: 0.7rem 1rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input-group input:focus,
.input-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.input-group select option { background: var(--bg2); }

.btn-primary {
  width: 100%; padding: 0.8rem; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; border-radius: var(--radius-sm); font-size: 0.95rem;
  font-weight: 600; font-family: 'DM Sans', sans-serif;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 0.5rem;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-warning {
  padding: 0.7rem 1.5rem; border: none; cursor: pointer;
  background: var(--warning); color: #1a1a1a;
  border-radius: var(--radius-sm); font-weight: 600;
  font-family: 'DM Sans', sans-serif; transition: opacity 0.2s;
}
.btn-warning:hover { opacity: 0.85; }

.btn-danger {
  padding: 0.8rem 2rem; border: none; cursor: pointer;
  background: var(--danger); color: white;
  border-radius: var(--radius-sm); font-weight: 600;
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.85; }

.btn-sm {
  padding: 0.3rem 0.8rem; border: none; cursor: pointer;
  border-radius: 6px; font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  transition: opacity 0.2s;
}
.btn-sm.edit { background: var(--primary); color: white; }
.btn-sm.del { background: var(--danger); color: white; }
.btn-sm:hover { opacity: 0.8; }

.alert {
  padding: 0.7rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-top: 0.8rem;
}
.alert-error { background: rgba(230,57,70,0.15); border: 1px solid var(--danger); color: #ff8a8a; }
.alert-success { background: rgba(42,157,143,0.15); border: 1px solid var(--success); color: #5dddd1; }
.alert-warning { background: rgba(233,196,106,0.15); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: rgba(0,180,216,0.1); border: 1px solid var(--primary); color: var(--primary); }

.demo-hint {
  text-align: center; font-size: 0.78rem; color: var(--text-dim); margin-top: 1rem;
}

/* ====== APP LAYOUT ====== */
.app-page { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--border); display: flex;
  flex-direction: column; position: fixed; top: 0; left: 0;
  height: 100vh; z-index: 100; transition: transform 0.3s;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1.5rem 1.2rem; border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 1.8rem; }
.brand-name-sm {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: 1rem; letter-spacing: 1px; color: var(--primary);
}
.brand-sub-sm { font-size: 0.7rem; color: var(--text-muted); }

.sidebar-nav {
  flex: 1; padding: 1rem 0.8rem; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.9rem; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-size: 0.88rem;
  transition: all 0.2s; cursor: pointer;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,180,216,0.2), transparent);
  color: var(--primary); border-left: 3px solid var(--primary);
}
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-user {
  padding: 1rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.7rem;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.7rem; color: var(--text-muted); }
.btn-logout {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.1rem; padding: 0.3rem;
  transition: color 0.2s;
}
.btn-logout:hover { color: var(--danger); }

/* MAIN */
.main-content {
  margin-left: var(--sidebar-w); flex: 1; min-height: 100vh;
  background: var(--bg);
}
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 1.3rem; cursor: pointer; }
.topbar-title {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.1rem;
}
.topbar-right { margin-left: auto; }
.date-display { font-size: 0.8rem; color: var(--text-muted); }

/* PAGES */
.page { display: none; padding: 1.5rem; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

.page-header { margin-bottom: 1.5rem; }
.page-header h2 {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.4rem;
}
.page-header p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 1.2rem; overflow: hidden;
}
.card-header {
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif; font-weight: 600; font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.card-body { padding: 1.5rem; }

/* FORMS */
.form-inline {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; align-items: end;
}
.form-inline .input-group { margin-bottom: 0; }
.form-inline .input-group.full { grid-column: 1/-1; }
.form-inline .btn-primary {
  width: auto; padding: 0.7rem 1.5rem; align-self: end;
}

/* STATS */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.2rem;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.stat-value {
  font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800;
  color: var(--primary);
}
.stat-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.2rem; }

/* DASHBOARD GRID */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* TABLES */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.data-table th {
  text-align: left; padding: 0.6rem 0.8rem;
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.data-table td {
  padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,180,216,0.04); }

/* BADGES */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.badge-success { background: rgba(42,157,143,0.2); color: #5dddd1; }
.badge-danger { background: rgba(230,57,70,0.2); color: #ff8a8a; }
.badge-warning { background: rgba(233,196,106,0.2); color: var(--warning); }
.badge-info { background: rgba(0,180,216,0.15); color: var(--primary); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* FILTER BAR */
.filter-bar {
  display: flex; gap: 0.8rem; margin-bottom: 1rem;
}
.filter-bar select {
  padding: 0.5rem 0.8rem; background: var(--bg2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 0.85rem; outline: none;
}

/* FISIK INPUT */
.fisik-qty {
  width: 100px; padding: 0.4rem 0.5rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: 'DM Sans', sans-serif;
  text-align: center; outline: none;
}
.fisik-qty:focus { border-color: var(--primary); }

/* SELISIH COLORS */
.selisih-lebih { color: #5dddd1; }
.selisih-kurang { color: #ff8a8a; }
.selisih-ok { color: var(--text-muted); }

/* SUMMARY BOX */
.summary-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1rem;
}
.summary-item {
  background: var(--bg2); border-radius: var(--radius-sm);
  padding: 1rem;
}
.summary-item .s-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.summary-item .s-value { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.2rem; }

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); display: flex;
  align-items: center; justify-content: center;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: 90%; max-width: 800px;
  max-height: 80vh; display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: 'Syne', sans-serif; font-weight: 700; }
.modal-header button {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; cursor: pointer; padding: 0.3rem;
}
.modal-header button:hover { color: var(--text); }
.modal-body { padding: 1.5rem; overflow-y: auto; }

/* TRANSAKSI RECENT */
.trx-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 0; border-bottom: 1px solid var(--border2);
}
.trx-item:last-child { border-bottom: none; }
.trx-nama { font-size: 0.85rem; font-weight: 500; }
.trx-info { font-size: 0.75rem; color: var(--text-muted); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .form-inline { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-container { width: 95%; padding: 1.5rem; }
}

/* EMPTY STATE */
.empty-state {
  text-align: center; padding: 2rem; color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
/* ====== READ ONLY ROLE (CREW) ====== */
.readonly {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(100%);
}



/* INLINE EDIT INPUT */

#bahan-table input{

  width: 100%;

  padding: 8px 10px;

  border-radius: 8px;

  border: 1px solid #334155;

  background: #0f172a;

  color: white;

  outline: none;

  font-size: 13px;
}

#bahan-table input:focus{

  border-color: #06b6d4;

  box-shadow: 0 0 5px rgba(6,182,212,0.4);
}

.btn-sm.edit{

  background: #06b6d4;

  color: white;

  border: none;

  padding: 7px 12px;

  border-radius: 8px;

  cursor: pointer;

  font-size: 12px;

  font-weight: 600;
}