/* ==========================================================================
   RUANG FINANSIAL - Stylesheet utama

   Daftar isi:
     1. Font & variabel warna (ubah warna brand di sini)
     2. Kerangka halaman (sidebar, topbar, konten, footer)
     3. Komponen (kartu, statistik, tabel, form, modal)
     4. Halaman login
     5. Responsif (tablet & mobile)
   ========================================================================== */

/* ---- 1. Font & variabel ------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../vendor/inter/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --rk-primary: #2563eb;
  --rk-primary-dark: #1d4ed8;
  --rk-primary-rgb: 37, 99, 235;
  --rk-success: #16a34a;
  --rk-danger: #dc2626;
  --rk-warning: #f59e0b;
  --rk-sidebar-bg: #0f172a;
  --rk-sidebar-text: #cbd5e1;
  --rk-sidebar-active: #1e293b;
  --rk-body-bg: #f1f5f9;
  --rk-sidebar-w: 264px;
  --rk-topbar-h: 60px;
  --rk-banner-h: 0px;

  /* Terapkan warna brand ke Bootstrap */
  --bs-primary: var(--rk-primary);
  --bs-primary-rgb: var(--rk-primary-rgb);
  --bs-link-color: var(--rk-primary);
  --bs-link-color-rgb: var(--rk-primary-rgb);
  --bs-link-hover-color: var(--rk-primary-dark);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: var(--rk-body-bg);
  --bs-body-color: #1e293b;
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .75rem;
}
.btn-primary {
  --bs-btn-bg: var(--rk-primary);
  --bs-btn-border-color: var(--rk-primary);
  --bs-btn-hover-bg: var(--rk-primary-dark);
  --bs-btn-hover-border-color: var(--rk-primary-dark);
  --bs-btn-active-bg: var(--rk-primary-dark);
  --bs-btn-active-border-color: var(--rk-primary-dark);
  --bs-btn-disabled-bg: var(--rk-primary);
  --bs-btn-disabled-border-color: var(--rk-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--rk-primary);
  --bs-btn-border-color: var(--rk-primary);
  --bs-btn-hover-bg: var(--rk-primary);
  --bs-btn-hover-border-color: var(--rk-primary);
  --bs-btn-active-bg: var(--rk-primary);
  --bs-btn-active-border-color: var(--rk-primary);
}
.text-bg-primary, .bg-primary { background-color: var(--rk-primary) !important; }
.form-control:focus, .form-select:focus {
  border-color: var(--rk-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--rk-primary-rgb), .18);
}

body { font-size: .925rem; }
body.rk-app.has-banner { --rk-banner-h: 38px; padding-top: var(--rk-banner-h); }

/* ---- 2. Kerangka halaman ------------------------------------------------ */
.rk-demo-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1060;
  height: 38px; line-height: 38px; padding: 0 1rem;
  background: #f59e0b; color: #1c1917; font-size: .82rem; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.rk-sidebar {
  position: fixed; top: var(--rk-banner-h); left: 0; bottom: 0; z-index: 1040;
  width: var(--rk-sidebar-w);
  background: var(--rk-sidebar-bg); color: var(--rk-sidebar-text);
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .25s ease;
}
.rk-brand {
  display: flex; align-items: center; gap: .65rem;
  height: var(--rk-topbar-h); padding: 0 1.25rem; flex-shrink: 0;
  color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.rk-brand:hover { color: #fff; }
.rk-user-panel { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; }
.rk-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #334155; flex-shrink: 0; }
.rk-avatar-sm { width: 32px; height: 32px; }
.rk-user-name { color: #fff; font-weight: 600; line-height: 1.2; word-break: break-word; }
.rk-user-status { font-size: .78rem; color: #94a3b8; }
.rk-user-status .fa-circle { color: #22c55e; font-size: .55rem; vertical-align: middle; }

.rk-nav { padding: .25rem .75rem 1.5rem; }
.rk-nav-header { padding: .75rem .5rem .5rem; font-size: .7rem; letter-spacing: .08em; color: #64748b; }
.rk-nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; margin-bottom: 2px; border-radius: .5rem;
  color: var(--rk-sidebar-text); text-decoration: none; font-weight: 500; font-size: .86rem;
}
.rk-nav-link > i:first-child { width: 1.1rem; text-align: center; font-size: .95rem; }
.rk-nav-link:hover { background: var(--rk-sidebar-active); color: #fff; }
.rk-nav-link.active { background: var(--rk-primary); color: #fff; }
.rk-caret { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.rk-nav-link[aria-expanded="true"] .rk-caret { transform: rotate(-90deg); }
.rk-submenu { padding-left: 1rem; }
.rk-submenu .rk-nav-link { font-weight: 400; padding: .45rem .75rem; }
.rk-submenu .rk-nav-link > i:first-child { font-size: .55rem; }
.rk-submenu .rk-nav-link.active { background: var(--rk-sidebar-active); color: #fff; }

.rk-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .55);
}

.rk-main {
  margin-left: var(--rk-sidebar-w); min-height: calc(100vh - var(--rk-banner-h));
  display: flex; flex-direction: column; transition: margin-left .25s ease;
}
body.sidebar-collapsed .rk-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .rk-main { margin-left: 0; }

.rk-topbar {
  position: sticky; top: var(--rk-banner-h); z-index: 1030;
  height: var(--rk-topbar-h); padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border-bottom: 1px solid #e2e8f0;
}
.rk-toggle { border: 0; background: transparent; font-size: 1.2rem; color: #475569; padding: .4rem .6rem; border-radius: .5rem; }
.rk-toggle:hover { background: #f1f5f9; }
.rk-topbar-user { font-size: .85rem; font-weight: 500; }

.rk-content { flex: 1; padding: 1.5rem; }
.rk-page-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; margin-bottom: 1.25rem;
}
.rk-page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.rk-page-header h1 small { font-size: .85rem; font-weight: 400; color: #64748b; margin-left: .35rem; }
.breadcrumb { font-size: .82rem; }

.rk-footer {
  padding: 1rem 1.5rem; font-size: .8rem; color: #64748b;
  background: #fff; border-top: 1px solid #e2e8f0;
}

/* ---- 3. Komponen -------------------------------------------------------- */
.card { border: 0; border-radius: .75rem; box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.card-header {
  background: transparent; border-bottom: 1px solid #e2e8f0; padding: 1rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
}
.card-header .card-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-accent { border-top: 3px solid var(--rk-primary); }

/* Kartu statistik dashboard */
.rk-stat {
  position: relative; overflow: hidden; border-radius: .75rem; color: #fff;
  padding: 1.1rem 1.25rem 0; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); height: 100%;
  display: flex; flex-direction: column;
}
.rk-stat-value { font-size: 1.15rem; font-weight: 700; margin: 0 0 .15rem; padding-right: 2.75rem; }
.rk-stat-label { margin: 0 0 1rem; opacity: .92; }
.rk-stat-icon { position: absolute; right: 1rem; top: .85rem; font-size: 2.6rem; opacity: .22; }
.rk-stat-footer {
  margin: auto -1.25rem 0; padding: .4rem 1.25rem; background: rgba(0, 0, 0, .12);
  color: #fff; text-decoration: none; font-size: .8rem; text-align: center;
}
.rk-stat-footer:hover { background: rgba(0, 0, 0, .22); color: #fff; }
.rk-stat.bg-green  { background: linear-gradient(135deg, #16a34a, #22c55e); }
.rk-stat.bg-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.rk-stat.bg-orange { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.rk-stat.bg-red    { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.rk-stat.bg-black  { background: linear-gradient(135deg, #0f172a, #334155); }

.rk-chart { position: relative; height: 300px; }

/* Kalender dashboard */
.rk-calendar { padding: .75rem 1rem 1rem; }
.rk-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; font-weight: 600; }
.rk-cal-head button { border: 0; background: transparent; color: #fff; padding: .15rem .6rem; border-radius: .4rem; }
.rk-cal-head button:hover { background: rgba(255, 255, 255, .2); }
.rk-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: .82rem; }
.rk-cal-grid .dow { font-size: .72rem; opacity: .8; padding: .25rem 0; }
.rk-cal-grid .day { padding: .4rem 0; border-radius: .4rem; }
.rk-cal-grid .day.muted { opacity: .4; }
.rk-cal-grid .day.today { background: #fff; color: #15803d; font-weight: 700; }

/* Tabel */
.table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.table thead th { font-size: .75rem; letter-spacing: .03em; text-transform: uppercase; color: #475569; background: #f8fafc; white-space: nowrap; }
.table td.nowrap, .table td.rk-nominal { white-space: nowrap; }
.rk-actions { white-space: nowrap; }
div.dt-container { font-size: .88rem; }
div.dt-container .dt-search input, div.dt-container .dt-length select { border-radius: .5rem; }
table.dataTable { width: 100% !important; }
.rk-foto { width: 64px; height: 64px; object-fit: cover; border-radius: 50%; }

.modal-content { border: 0; border-radius: .75rem; }
.form-label { font-weight: 500; font-size: .86rem; }

/* ---- 4. Halaman login --------------------------------------------------- */
body.rk-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
}
body.rk-login.has-banner { padding-top: calc(var(--rk-banner-h) + 1.5rem); }
.rk-login-box { width: 100%; max-width: 420px; margin-top: .75rem; }
.rk-login-title { color: #fff; text-align: center; margin-bottom: 1.25rem; }
.rk-login-title h2 { font-weight: 800; letter-spacing: .02em; margin: 0; font-size: 1.5rem; }
.rk-login-title h3 { font-weight: 400; margin: .15rem 0 0; font-size: 1.05rem; opacity: .9; }
.rk-login-card { border-radius: 1rem; box-shadow: 0 20px 45px rgba(15, 23, 42, .3); }
.rk-login-logo { width: 84px; height: 84px; }
.rk-demo-box { background: #fffbeb; border: 1px dashed #f59e0b; border-radius: .75rem; font-size: .82rem; }
.rk-login-footer { margin-top: 1.25rem; text-align: center; color: rgba(255, 255, 255, .85); font-size: .8rem; }
.rk-login-footer a { color: #fff; }

/* ---- 5. Responsif -------------------------------------------------------- */
@media (max-width: 991.98px) {
  .rk-sidebar { transform: translateX(-100%); box-shadow: none; }
  .rk-main { margin-left: 0; }
  body.sidebar-open .rk-sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.sidebar-open .rk-backdrop { display: block; }
  /* di layar kecil, kelas collapsed tidak dipakai */
  body.sidebar-collapsed .rk-sidebar { transform: translateX(-100%); }
  body.sidebar-open.sidebar-collapsed .rk-sidebar { transform: translateX(0); }
}
@media (max-width: 575.98px) {
  .rk-stat-value { font-size: 1rem; padding-right: 0; }
  .rk-stat-icon { font-size: 2rem; }
  .rk-content { padding: 1rem .75rem; }
  .rk-topbar { padding: 0 .75rem; }
  .rk-page-header h1 { font-size: 1.25rem; }
  .card-header, .card-body { padding: .9rem; }
  .rk-demo-banner { font-size: .72rem; padding: 0 .5rem; }
  .modal-dialog { margin: .75rem; }
  div.dt-container .dt-search { text-align: left !important; margin-top: .5rem; }
  div.dt-container .dt-search input { width: 100%; margin-left: 0 !important; }
}
