:root {
  --bg: #f3f4f8;
  --panel: #ffffff;
  --panel-muted: #f8f8fb;
  --line: #e9eaf0;
  --text: #272d3b;
  --muted: #7a8297;
  --danger: #df2a2a;
  --danger-deep: #b40f16;
  --danger-soft: #fff1f1;
  --warning: #f4a327;
  --success: #1da866;
  --shadow: 0 18px 40px rgba(24, 31, 56, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(223, 42, 42, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 194, 91, 0.18), transparent 22%),
    linear-gradient(180deg, #f7f8fb 0%, #edeff5 100%);
}

body.admin-mode {
  background: linear-gradient(180deg, #f4f6fb 0%, #eef2f8 100%);
}

body.flash-signal::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 210, 0.55);
  pointer-events: none;
  z-index: 9999;
}

button,
input {
  font: inherit;
}

input[type="file"] {
  padding: 12px 14px;
  height: auto;
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.phone {
  width: 100%;
  max-width: 390px;
  min-height: 820px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  border-radius: 34px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
  font-size: 13px;
  font-weight: 700;
}

.screen {
  padding: 4px 18px 108px;
}

.hero-card,
.summary-card,
.profile-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--danger) 0%, #ec3636 45%, var(--danger-deep) 100%);
  box-shadow: 0 12px 24px rgba(223, 42, 42, 0.28);
}

.hero-card::before,
.summary-card::before,
.profile-card::before {
  content: "";
  position: absolute;
  inset: -20% auto auto 45%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.hero-card::after,
.summary-card::after,
.profile-card::after {
  content: "";
  position: absolute;
  inset: auto auto -20% -8%;
  width: 210px;
  height: 130px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 48% 52% 0 0;
  transform: rotate(-8deg);
}

.login-screen {
  min-height: 820px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.brand-title {
  font-size: 13px;
  color: var(--muted);
}

.brand-title strong {
  display: block;
  font-size: 24px;
  color: #d62828;
  line-height: 1.05;
}

.login-panel {
  margin-top: 24px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #555f77;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
}

.field input:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.row-between > * {
  flex: 1 1 0;
  min-width: 0;
}

.helper-link,
.text-button {
  border: 0;
  padding: 0;
  background: none;
  color: #d62828;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #cb1f26);
  box-shadow: 0 12px 22px rgba(223, 42, 42, 0.24);
}

.secondary-btn {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-tone {
  background: #fff;
  color: var(--text);
}

.login-footer {
  height: 140px;
  margin: 0 -24px -24px;
  background:
    radial-gradient(circle at 10% 150%, #ef4444 0 35%, transparent 36%),
    radial-gradient(circle at 45% 145%, #d61f1f 0 34%, transparent 35%),
    radial-gradient(circle at 80% 155%, #b30f16 0 35%, transparent 36%),
    linear-gradient(180deg, transparent 0%, #fafafb 30%);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--panel-muted);
  color: #5a6174;
  cursor: pointer;
}

.hero-card {
  padding: 20px;
}

.hero-card .welcome {
  font-size: 14px;
  opacity: 0.88;
}

.hero-card h2 {
  margin: 8px 0 16px;
  font-size: 24px;
  line-height: 1.2;
}

.big-balance {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
}

.sub-balance {
  font-size: 14px;
  opacity: 0.92;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 22px;
}

.action-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #4a5165;
}

.action-button {
  cursor: pointer;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  font-size: 12px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
  align-items: center;
}

.list-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.green {
  background: #e8faf1;
  color: var(--success);
}

.red {
  background: #fff1f1;
  color: var(--danger);
}

.amber {
  background: #fff6e8;
  color: var(--warning);
}

.item-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.item-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.item-amount {
  text-align: right;
  font-size: 14px;
  font-weight: 800;
}

.amount-positive {
  color: var(--success);
}

.amount-negative {
  color: var(--danger);
}

.summary-card {
  padding: 18px;
  margin-bottom: 18px;
}

.summary-label {
  font-size: 14px;
  opacity: 0.9;
}

.summary-card h2 {
  margin: 10px 0 4px;
  font-size: 34px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.mini-stat {
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.mini-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.loan-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.schedule-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.schedule-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.schedule-row:last-child {
  border-bottom: 0;
}

.profile-card {
  padding: 20px;
  margin-bottom: 18px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff, #ffe7b8);
  color: #a85b00;
  font-size: 26px;
  font-weight: 800;
  border: 4px solid rgba(255, 255, 255, 0.6);
}

.profile-card h2,
.profile-card p {
  margin: 0;
}

.stars {
  margin-top: 12px;
  letter-spacing: 3px;
}

.menu-list {
  display: grid;
  gap: 12px;
}

.menu-item {
  width: 100%;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.menu-item strong {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.danger-btn {
  width: 100%;
  margin-top: 18px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #c11b23);
  cursor: pointer;
  font-weight: 800;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(233, 234, 240, 0.85);
}

.nav-item {
  border: 0;
  background: none;
  padding: 8px 4px;
  color: #7a8297;
  cursor: pointer;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active {
  color: var(--danger);
  background: var(--danger-soft);
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #fff;
  color: var(--danger);
}

.notice {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff6e8;
  border: 1px solid #ffe0af;
  color: #966109;
  font-size: 13px;
  line-height: 1.5;
}

.native-card {
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid #ffd6c8;
  background: linear-gradient(135deg, #fffaf6 0%, #fff 100%);
}

.native-card strong {
  display: block;
  margin-bottom: 6px;
}

.native-card-compact {
  margin-top: 14px;
}

.native-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.small-text {
  font-size: 12px;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  padding: 24px;
}

.admin-sidebar {
  background: #172033;
  color: #fff;
  border-radius: 28px;
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 12px;
  box-shadow: var(--shadow);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.admin-nav {
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #d7dced;
  font-weight: 700;
  cursor: pointer;
}

.admin-nav.active {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}

.admin-main {
  display: grid;
  gap: 18px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-topbar h1,
.admin-topbar p {
  margin: 0;
}

.admin-topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.admin-refresh {
  max-width: 180px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-card,
.admin-section {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.admin-card {
  padding: 18px 20px;
}

.admin-card span {
  display: block;
  color: var(--muted);
}

.admin-card strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.admin-section {
  padding: 20px;
}

.registration-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, #172033 0%, #253453 100%);
}

.registration-hero h2 {
  margin: 6px 0;
  font-size: 28px;
}

.registration-hero-side {
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #f8f9fc;
}

.detail-card h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.detail-card-accent {
  background: linear-gradient(180deg, #fff 0%, #fff8f3 100%);
  border-color: #ffd8bf;
}

.detail-meta {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #535d75;
}

.report-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
  align-items: end;
}

.report-row,
.journal-row {
  grid-template-columns: 1.4fr .8fr .5fr .4fr;
}

.approve-inline {
  max-width: 180px;
}

.table-list {
  display: grid;
  gap: 12px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.6fr .7fr .5fr .5fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: #f8f9fc;
  border: 1px solid var(--line);
}

.table-amount {
  font-weight: 800;
}

.table-status {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pending,
.status-baru,
.status-diproses {
  background: #fff6e8;
  color: #b56b00;
}

.status-approved,
.status-posted,
.status-active,
.status-selesai {
  background: #e8faf1;
  color: #14804d;
}

.status-rejected {
  background: #fff1f1;
  color: #cf1f1f;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
}

.mini-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #172033;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(21, 28, 45, 0.42);
  z-index: 8;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 18px;
  box-shadow: 0 -12px 30px rgba(26, 33, 54, 0.18);
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 760px);
}

.sheet-head,
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-head {
  margin-bottom: 14px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 20px;
}

.sheet-body {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  overflow-y: auto;
  padding-right: 4px;
  min-height: 0;
}

.sheet-foot .primary-btn,
.sheet-foot .secondary-btn {
  flex: 1;
}

.media-preview {
  width: 100%;
  min-height: 180px;
  background: #101828;
  border-radius: 16px;
  margin-bottom: 10px;
}

.media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.media-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.map-frame {
  width: 100%;
  height: 180px;
  border: 0;
  border-radius: 18px;
}

@media (max-width: 480px) {
  .app-shell {
    padding: 0;
  }

  .phone {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }

  .login-screen {
    min-height: 100vh;
  }

  .sheet {
    max-height: calc(100vh - 8px);
    border-radius: 24px 24px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .sheet-foot {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 10px;
  }

  .sheet-foot .primary-btn,
  .sheet-foot .secondary-btn,
  .row-between > button,
  .row-between > .secondary-btn,
  .row-between > .primary-btn {
    min-height: 50px;
  }

  .media-preview {
    min-height: 160px;
  }
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .report-toolbar {
    grid-template-columns: 1fr;
  }

  .registration-hero {
    grid-template-columns: 1fr;
    display: grid;
  }

  .registration-hero-side {
    text-align: left;
  }
}
