/* ================================================================
   PORTAL PROYEK SIKAN – TUMPUNG LAUNG
   Tema: Merah & Biru (PT. Wiratama Globalindo Jaya)
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
  /* === PALET UTAMA: MERAH & BIRU === */
  --red:          #dc2626;
  --red-dark:     #b91c1c;
  --red-deeper:   #991b1b;
  --red-soft:     #fee2e2;
  --red-mid:      #fca5a5;

  --blue:         #1d4ed8;
  --blue-dark:    #1e3a8a;
  --blue-deeper:  #172554;
  --blue-soft:    #dbeafe;
  --blue-mid:     #93c5fd;

  /* Aksen & netral */
  --navy:         #1e3a8a;
  --green:        #16a34a;
  --green-soft:   #dcfce7;
  --amber:        #d97706;
  --amber-soft:   #fef3c7;
  --purple:       #7c3aed;

  /* Teks */
  --ink:          #111827;
  --ink-2:        #374151;
  --muted:        #6b7280;
  --line:         #e5e7eb;

  /* Sidebar gradien */
  --sidebar-bg:   linear-gradient(180deg, #1e3a8a 0%, #172554 40%, #7f1d1d 100%);
  --sidebar-text: rgba(255,255,255,0.92);
  --sidebar-muted:rgba(255,255,255,0.55);
  --sidebar-hover:rgba(255,255,255,0.12);
  --sidebar-active:rgba(255,255,255,0.18);
  --sidebar-border:rgba(255,255,255,0.08);

  /* Topbar */
  --topbar-bg:    #ffffff;
  --topbar-shadow:0 1px 0 var(--line);

  /* KPI cards */
  --card-shadow:  0 1px 4px rgba(0,0,0,.07), 0 2px 12px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 14px; }
body {
  margin: 0;
  font-family: Montserrat, "Segoe UI", system-ui, sans-serif;
  background: #f3f4f6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 12px; font-weight: 700; }
h1 { font-size: 18px; }
h2 { font-size: 15px; color: var(--ink-2); }
p  { margin: 0 0 8px; }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ───────────────────────── LAYOUT ───────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 252px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 20;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-mark {
  width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.32), 0 0 0 1px rgba(255,255,255,0.25);
  flex-shrink: 0;
  padding: 4px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.brand-mark:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0,0,0,0.38), 0 0 0 1px rgba(255,255,255,0.35);
}
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.brand div { min-width: 0; flex: 1; }
.brand b  { display: block; color: #fff; font-size: 13px; font-weight: 800; line-height: 1.2; letter-spacing: 0.02em; word-break: break-word; }
.brand span { display: block; color: var(--sidebar-muted); font-size: 10.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

nav#nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
nav#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--sidebar-text); font-size: 12.5px; font-weight: 500;
  text-decoration: none; transition: background .15s;
  position: relative; white-space: nowrap;
}
nav#nav a:hover  { background: var(--sidebar-hover); }
nav#nav a.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--red-mid);
  font-weight: 700;
}
nav#nav a .ic { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.badge {
  margin-left: auto; background: var(--red);
  color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700;
  padding: 1px 6px; min-width: 18px; text-align: center;
}

.side-foot { padding: 10px 16px 14px; border-top: 1px solid var(--sidebar-border); }
.version-tag { color: var(--sidebar-muted); font-size: 10.5px; }

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

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: var(--topbar-bg);
  box-shadow: var(--topbar-shadow);
  flex-shrink: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.topbar .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.menu-btn { display: none; }

.view {
  flex: 1; overflow-y: auto;
  padding: 20px 24px 40px;
  display: flex; flex-direction: column; gap: 0;
}

/* ───────────────────────── CARD & GRID ───────────────────────── */
.card {
  background: #fff; border-radius: 12px;
  padding: 16px; box-shadow: var(--card-shadow);
  border: 1px solid var(--line);
}
.grid { display: grid; gap: 14px; }
.g2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: 1fr 340px; }

/* ───────────────────────── KPI CARD ───────────────────────── */
.kpi { position: relative; overflow: hidden; }
.kpi::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--red), var(--blue));
}
.kpi .lbl { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.kpi .val { font-size: 26px; font-weight: 800; margin: 6px 0 4px; color: var(--ink); line-height: 1; }
.kpi .note { font-size: 11.5px; color: var(--muted); }
.bar { height: 5px; background: #eef0f5; border-radius: 3px; margin-top: 10px; position: relative; overflow: visible; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--red)); border-radius: 3px; transition: width .6s ease; }
.bar b { position: absolute; top: -2px; width: 2px; height: 9px; background: var(--amber); border-radius: 1px; transform: translateX(-50%); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ───────────────────────── TOMBOL ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: 0;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  box-shadow: 0 2px 8px rgba(220,38,38,.35);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--red-deeper), var(--red-dark)); }
.btn.blue {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,78,216,.3);
}
.btn.blue:hover { background: linear-gradient(135deg, var(--blue-deeper), var(--blue-dark)); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f5f5f7; }
.btn.sm { padding: 5px 12px; font-size: 12px; }
.btn.danger { background: var(--red-soft); color: var(--red-dark); }
.btn.danger:hover { background: var(--red-mid); }

.icon-btn {
  background: none; border: 0; cursor: pointer; font-size: 18px;
  padding: 6px 8px; border-radius: 8px; color: var(--ink-2);
  transition: background .15s;
}
.icon-btn:hover { background: #f0f2f5; }

/* ───────────────────────── CHIP & TAG ───────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: #f3f4f6; border-radius: 20px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line);
}
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.tag.draft   { background: #fef9c3; color: #854d0e; }
.tag.disetujui { background: var(--green-soft); color: var(--green); }
.tag.ditolak { background: var(--red-soft); color: var(--red-dark); }
.tag.diajukan { background: var(--blue-soft); color: var(--blue-dark); }
.tag.code { background: #f3f4f6; color: var(--ink-2); font-family: monospace; }

/* ───────────────────────── ALERT ───────────────────────── */
.alert {
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.alert.red   { background: var(--red-soft);  border-left: 4px solid var(--red);  color: var(--red-deeper); }
.alert.amber { background: var(--amber-soft); border-left: 4px solid var(--amber); color: #78350f; }
.alert.blue  { background: var(--blue-soft);  border-left: 4px solid var(--blue);  color: var(--blue-dark); }
.alert.green { background: var(--green-soft); border-left: 4px solid var(--green); color: #14532d; }
.alert a, .alert .btn { margin-left: auto; flex-shrink: 0; }

/* ───────────────────────── ROW & FLEX ───────────────────────── */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ───────────────────────── FORM ───────────────────────── */
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
input, select, textarea {
  font: inherit; font-size: 13.5px; padding: 8px 10px;
  border: 1.5px solid #d5d9e2; border-radius: 8px;
  background: #fff; color: var(--ink); min-width: 0; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.seg { display: inline-flex; border: 1px solid #d5d9e2; border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.seg button.on { background: var(--red-dark); color: #fff; }
.seg button + button { border-left: 1px solid #d5d9e2; }

/* ───────────────────────── TABLE ───────────────────────── */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; background: #f8f9fb; color: var(--ink-2);
  font-weight: 700; font-size: 11.5px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0;
}
td { padding: 7px 10px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.grp td { background: #fef2f2; font-weight: 700; color: var(--red-dark); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--blue-soft); }

/* Keuangan */
.fin-insight { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; }
.fin-insight > div { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-left: 1px solid var(--line, #e5e7eb); }
.fin-insight > div:first-child { border-left: 0; }
.fin-insight .lbl { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.fin-insight b { font-size: 18px; font-weight: 800; }
.fin-2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1700px) { .fin-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fin-filter select, .fin-filter input { width: auto; }
.tag.fin-ok  { background: var(--green-soft); color: var(--green); }
.tag.fin-warn { background: var(--amber-soft); color: #92400e; }
.tag.fin-over { background: var(--red-soft); color: var(--red-dark); }
.tag.fin-nb   { background: #f3f4f6; color: var(--ink-2); }
@media (max-width: 820px) {
  .fin-insight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-insight > div:nth-child(3) { border-left: 0; }
}
tr.clickable:hover td { background: #fff5f5; }
tr.sel td { background: var(--blue-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; background: #f8f9fb; }
.mini-bar { width: 70px; height: 6px; background: #eef1f6; border-radius: 4px; display: inline-block; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--red)); }

/* ───────────────────────── FOTO ───────────────────────── */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo { position: relative; border-radius: 10px; overflow: hidden; background: #e5e7eb; aspect-ratio: 4/3; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; font-size: 11px; padding: 14px 8px 6px;
}
.photo .del { position: absolute; top: 4px; right: 4px; background: rgba(220,38,38,.8); color: #fff; border: 0; border-radius: 6px; cursor: pointer; font-size: 12px; padding: 2px 6px; }
.drop { border: 2px dashed #c7cfdd; border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; }
.drop:hover { border-color: var(--red); color: var(--red); }

/* ───────────────────────── MISC ───────────────────────── */
.list-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f2f6; font-size: 13px; }
.list-item:last-child { border-bottom: 0; }
.list-item .t { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 24px; font-size: 13px; }
.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 200px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.kbd { font-family: ui-monospace, Consolas, monospace; background: #eef1f6; border-radius: 5px; padding: 1px 6px; font-size: 12px; }
.report-card { display: flex; flex-direction: column; gap: 10px; }
.report-card .ic { font-size: 22px; }
.report-card p { margin: 0; color: var(--muted); font-size: 12.5px; flex: 1; }

.role { border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.role.admin  { background: linear-gradient(135deg, var(--red-dark), var(--blue-dark)); color: #fff; }
.role.staff  { background: var(--blue-soft); color: var(--blue-dark); }
.role.viewer { background: var(--amber-soft); color: var(--amber); }

.user-chip { cursor: pointer; font: inherit; font-size: 12px; }
.user-chip:hover { background: #e8edf6; }

/* ───────────────────────── TOAST & MODAL ───────────────────────── */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px; transition: transform .25s; z-index: 50; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err  { background: var(--red-dark); }

.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; z-index: 40; padding: 16px;
}
.modal-card { background: #fff; border-radius: 14px; max-width: 920px; width: 100%; max-height: 92vh; overflow: auto; padding: 20px; position: relative; }
.modal-card img { max-width: 100%; border-radius: 8px; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.err { color: var(--red); font-size: 13px; margin: 0; min-height: 18px; }

/* ───────────────────────── LOGIN PAGE ───────────────────────── */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #172554 0%, #1e3a8a 40%, #7f1d1d 100%);
  font-family: Montserrat, "Segoe UI", system-ui, sans-serif;
  position: relative; overflow: hidden;
}
.login::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(220,38,38,.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(29,78,216,.2) 0%, transparent 60%);
  pointer-events: none;
}
.login-shell {
  display: grid; grid-template-columns: 1fr 1fr;
  width: 100%; max-width: 900px; min-height: 500px;
  background: #fff; border-radius: 28px;
  box-shadow: 0 32px 80px rgba(5,12,40,.55);
  position: relative; z-index: 1;
}
.login-form {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 44px 52px; text-align: center;
}
.login-logo { display: block; width: 100%; max-width: 280px; height: auto; margin-bottom: 8px; object-fit: contain; }
.login-form h1 { margin: 0; font-size: 28px; font-weight: 800; color: var(--blue-dark); }
.login-hint  { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.login-form input {
  width: 100%; max-width: 300px;
  background: #f3f4f6; border: 1.5px solid transparent; border-radius: 8px;
  padding: 12px 15px; font: inherit; font-size: 13.5px; color: var(--ink);
  transition: all .2s;
}
.login-form input:focus { outline: none; background: #fff; border-color: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.login-forgot { margin: 4px 0 6px; font-size: 12.5px; color: var(--muted); }
.login-btn {
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 50%, var(--blue-dark) 100%);
  background-size: 200% 200%;
  color: #fff; border: 0; border-radius: 8px;
  padding: 12px 52px; font: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: .06em; cursor: pointer;
  transition: all .3s; box-shadow: 0 4px 15px rgba(220,38,38,.4);
}
.login-btn:hover { background-position: right center; box-shadow: 0 6px 20px rgba(220,38,38,.5); transform: translateY(-1px); }
.login-btn:active { transform: scale(.97); }
.login-btn:disabled { opacity: .6; cursor: wait; }

.login-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 44px 48px; text-align: center; color: #fff;
  background: linear-gradient(150deg, var(--blue-dark) 0%, var(--blue-deeper) 50%, var(--red-deeper) 100%);
  border-radius: 0 28px 28px 0;
  position: relative; overflow: hidden;
}
.login-panel::after {
  content: "";
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-kicker { border: 1.5px solid rgba(255,255,255,.8); border-radius: 8px; padding: 6px 22px; font-size: 13px; font-weight: 700; letter-spacing: .25em; position: relative; z-index: 1; }
.login-panel h2 { margin: 6px 0 0; font-size: 28px; font-weight: 800; line-height: 1.25; position: relative; z-index: 1; }
.login-panel p  { margin: 0; font-size: 13.5px; line-height: 1.7; opacity: .9; position: relative; z-index: 1; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-panel { order: -1; padding: 28px 24px; border-radius: 28px 28px 0 0; }
  .login-panel h2 { font-size: 22px; }
  .login-form { padding: 28px 22px 32px; }
}

/* ───────────────────────── RESPONSIVE ───────────────────────── */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; z-index: 30; transition: left .22s cubic-bezier(.4,0,.2,1); }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  #todayChip { display: none; }
  .user-chip .role { display: none; }
}
@media (max-width: 480px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .val { font-size: 20px; }
}

/* ───────────────────────── ANIMASI ───────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.view > * { animation: fadeIn .22s ease both; }

/* Header gradient divider */
.page-header {
  padding: 0 0 16px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--red), var(--blue)) 1;
  margin-bottom: 18px;
}

/* Progress bar dalam tabel */
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .bar { flex: 1; margin: 0; }
