:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #122033;
  --muted: #5d6b82;
  --primary: #0f766e;
  --primary-soft: #d9f7f1;
  --border: #dbe3ee;
  --success: #dff7e7;
  --success-text: #0a6b34;
  --danger: #ffe6e6;
  --danger-text: #a53232;
  --warning: #fff7db;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #d9f7f1 0%, #f3f6fb 45%, #eef2ff 100%);
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #082f2a 0%, #0f766e 100%);
  color: #fff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge,
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-badge {
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-brand small,
.user-chip small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 4px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.86);
  padding: 14px 16px;
  border-radius: 14px;
  transition: 0.2s ease;
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-footer { 
    flex-shrink: 0; 
    background-color: transparent !important; /* Diubah jadi transparent agar menyatu dengan background atasnya */
    z-index: 10; 
    padding-top: 20px; 
    margin-top: auto; 
    padding-bottom: 12px; 
    padding-left: 16px; /* Tambahan padding agar sejajar */
    padding-right: 16px;
}

.user-chip { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    padding: 12px; 
    border-radius: 16px; 
    background: rgba(255, 255, 255, 0.12); 
    margin-bottom: 16px; /* Tambahan sedikit jarak ke tombol */
}

.avatar {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  background: rgba(243, 246, 251, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
}

/* MOBILE FIX HEADER */
@media (max-width: 900px) {
  .topbar {
    position: static;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-heading {
    flex: 1 1 100%;
  }

  .topbar h1 {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .topbar-meta {
    width: 100%;
    justify-content: flex-start;
  }
}

.topbar h1,
.login-card h1,
.page-title {
  margin: 0;
}

.topbar p,
.muted,
.helper-text,
.card-subtitle,
.login-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.menu-button {
  display: none;
  border: 0;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.login-card,
.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card,
.panel {
  padding: 22px;
}

.login-wrap {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.login-hero {
  padding: 40px;
  background: linear-gradient(145deg, #0f766e 0%, #0b5a54 40%, #052c28 100%);
  color: #fff;
}

.login-hero h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-top: 0;
  margin-bottom: 12px;
}

.login-hero p {
  color: rgba(255,255,255,0.82);
  line-height: 1.7;
  max-width: 560px;
}

.hero-checklist {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.hero-checklist div {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
}

.login-card {
  padding: 34px;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
}

.alert-success {
  background: var(--success);
  color: var(--success-text);
  border-color: #b5ecc7;
}

.alert-error {
  background: var(--danger);
  color: var(--danger-text);
  border-color: #ffc5c5;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 700;
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: #1d4ed8;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-light {
  background: var(--panel-soft);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
}

.btn-block {
  width: 100%;
}

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

.metric-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  inset: auto -30px -30px auto;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
}

.metric-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.94rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  margin: 10px 0 6px;
}

.metric-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
}

.pill {
  background: var(--panel);
  border: 1px solid var(--border);
}

.badge {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.grade-A { background: #dcfce7; color: #166534; }
.badge.grade-B { background: #dbeafe; color: #1d4ed8; }
.badge.grade-C { background: #fef3c7; color: #b45309; }
.badge.grade-D { background: #fee2e2; color: #b91c1c; }

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.table th,
.table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table tbody tr:hover {
  background: #fbfdff;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.split-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.score-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.score-mini {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fffd 100%);
  border: 1px solid var(--border);
}

.score-mini strong {
  display: block;
  font-size: 1.7rem;
  margin-top: 10px;
}

.instrument-card {
  padding: 0;
  overflow: hidden;
}

.instrument-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f8fffd 0%, #ffffff 100%);
}

.instrument-body {
  padding: 20px 22px 22px;
  display: grid;
  gap: 16px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.section-label .tag {
  background: #d8f3ee;
  color: var(--primary);
  min-width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
}

.group-title {
  margin: 10px 0 0;
  font-weight: 700;
  color: #20304a;
}

.instrument-table {
  width: 100%;
  border-collapse: collapse;
}

.instrument-table th,
.instrument-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.instrument-table th {
  font-size: 0.86rem;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
}

.row-index {
  width: 54px;
  color: var(--muted);
  font-weight: 700;
}

.score-selector {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-selector label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.score-selector input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.score-selector input:checked + span {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.score-selector span {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid transparent;
}

.summary-banner {
  background: linear-gradient(135deg, #0f766e 0%, #0b5a54 100%);
  color: #fff;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary-banner .helper-text,
.summary-banner p {
  color: rgba(255,255,255,0.82);
}

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

.info-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.info-item label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.legend-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.print-report {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
  background: #fff;
}

.print-page {
  margin-bottom: 24px;
  page-break-after: always;
}

.print-page:last-child {
  page-break-after: auto;
}

.print-header {
  text-align: center;
  margin-bottom: 18px;
}

.print-header h2,
.print-header h3 {
  margin: 0;
}

.report-meta {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

.report-meta td {
  padding: 4px 8px;
  vertical-align: top;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.report-table th,
.report-table td {
  border: 1px solid #2f3f57;
  padding: 7px 8px;
  vertical-align: top;
}

.report-table .section-row {
  background: #97f05c;
  font-weight: 700;
}

.report-table .subtotal-row {
  background: #f8e49a;
  font-weight: 700;
}

.report-table .summary-row {
  background: #d9ebff;
  font-weight: 700;
}

.report-table .predikat-row {
  background: #fff34d;
  font-weight: 700;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.signature-box {
  text-align: center;
}

.signature-space {
  height: 72px;
}

.note-box {
  margin-top: 14px;
  line-height: 1.7;
}

@media (max-width: 1100px) {
  .metric-grid,
  .grid.cols-4,
  .grid.cols-3,
  .score-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 60;
    width: min(82vw, 320px);
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 40;
  }

  .menu-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    padding: 18px 16px;
  }

  .content {
    padding: 18px 16px 28px;
  }

  .grid.cols-2,
  .form-grid.cols-2,
  .form-grid.cols-3,
  .info-grid,
  .signature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .grid.cols-4,
  .grid.cols-3,
  .score-board {
    grid-template-columns: 1fr;
  }

  .score-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .instrument-table,
  .instrument-table tbody,
  .instrument-table tr,
  .instrument-table td,
  .instrument-table th {
    display: block;
    width: 100%;
  }

  .instrument-table thead {
    display: none;
  }

  .instrument-table tr {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }

  .instrument-table td {
    padding: 8px 0;
    border: 0;
  }

  .row-index {
    font-size: 0.85rem;
  }

  .actions {
    flex-direction: column;
  }
}

/* TABLE → CARD MODE (MOBILE) */
@media (max-width: 760px) {
  .table {
    min-width: 0;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: grid;
    gap: 14px;
  }

  .table tr {
    display: block;
    background: #fff;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

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

  .table td:last-child {
    border-bottom: none;
  }

  .table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    min-width: 45%;
  }

  .actions .btn {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .no-print {
    display: none !important;
  }

  .print-report {
    padding: 0;
    max-width: 100%;
  }
}


.brand-logo,
.topbar-logo,
.login-logo,
.print-logo {
  object-fit: contain;
  background: #fff;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.topbar-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
}

.print-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .topbar-logo {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 640px) {
  .brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .login-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }
}
