/* GS Portal - tampilan (gaya sama dengan CR v1.1) */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f4c81;
  --brand-2: #1565c0;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef9c3;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --gray-bg: #f3f4f6;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }
pre { white-space: pre-wrap; margin: 6px 0 0; font-size: 12px; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--brand); color: #fff; padding: 8px 16px;
}
.topbar a { color: #dbeafe; }
.brand a { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.menu { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.menu a { padding: 6px 10px; border-radius: 6px; }
.menu a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.menu a.active { background: #fff; color: var(--brand); font-weight: 600; }
.userbox { display: flex; gap: 8px; align-items: center; }
.btn-link { background: none; border: 0; color: #dbeafe; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

.container { max-width: 1500px; margin: 0 auto; padding: 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- panel / form ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.filters .check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 13px; padding-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=search], select, textarea {
  font: inherit; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: #60a5fa; }
.btn {
  display: inline-block; font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--brand-2);
  background: var(--brand-2); color: #fff; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--brand-2); }
.btn-danger { background: var(--err); border-color: var(--err); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.actions .sep { flex: 1; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: var(--panel); border-color: var(--line); color: var(--text); font-weight: 600; margin-bottom: -1px; }
.tabs .count { background: var(--gray-bg); border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: #f8fafc; font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
.grid tr:hover td { background: #f8fbff; }
.grid tr.checked td { background: #eff6ff; }
.grid td.cb, .grid th.cb { width: 28px; text-align: center; }
.grid .empty { text-align: center; color: var(--muted); padding: 24px; }
.subject { max-width: 340px; }

/* ---------- badge / alert ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-yellow { background: var(--warn-bg); color: var(--warn); }
.badge-red { background: var(--err-bg); color: var(--err); }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray { background: var(--gray-bg); color: var(--muted); }
.alert { padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: #fecaca; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #bfdbfe; }

/* ---------- CMP ---------- */
.cmp-field { display: inline-flex; flex-direction: column; gap: 2px; }
.cmp-input { width: 120px; font-family: ui-monospace, Consolas, monospace; }
.cmp-name { font-size: 11px; color: var(--muted); max-width: 200px; }
.cmp-name.unknown { color: var(--err); }
.cmp-badge { display: inline-block; background: var(--info-bg); color: #1e3a8a; padding: 1px 7px; border-radius: 4px; font-size: 12px; margin: 1px 0; }
.cmp-chip {
  font: 11px ui-monospace, Consolas, monospace; border: 1px solid #93c5fd; background: #eff6ff; color: #1e40af;
  border-radius: 10px; padding: 1px 7px; cursor: pointer; margin: 2px 2px 0 0;
}
.cmp-chip.primary { background: #1e40af; color: #fff; border-color: #1e40af; }
.cmp-chip:hover { filter: brightness(.95); }

/* ---------- dashboard ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.card .num { font-size: 28px; font-weight: 700; color: var(--brand); }
.card .lbl { color: var(--muted); font-size: 13px; }
.card a { display: block; margin-top: 6px; font-size: 13px; }

/* ---------- login ---------- */
.login-box { max-width: 360px; margin: 60px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.login-box h1 { text-align: center; color: var(--brand); }
.login-box label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.login-box input { width: 100%; margin-top: 4px; }
.login-box .btn { width: 100%; }

/* ---------- kv ---------- */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 700px) {
  .kv { grid-template-columns: 1fr; }
  .menu { order: 3; flex-basis: 100%; }
}

/* ---------- KB User (chat) ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.bubble { max-width: 80%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.bubble.me { align-self: flex-end; background: #e0f2fe; border-color: #bae6fd; }
.bubble.ai { align-self: flex-start; }
.bubble .who { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bubble .txt { line-height: 1.55; }
.chat-media { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.chat-media figure { margin: 0; width: 260px; }
.chat-media img { width: 100%; max-height: 200px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.chat-media figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; }
.feedback { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px dashed var(--line); padding-top: 8px; }
.feedback .small { flex-basis: 100%; }
.chat-input { display: flex; gap: 8px; max-width: 900px; margin-top: 14px; align-items: flex-end; }
.chat-input textarea { flex: 1; }
.busy-note { color: var(--muted); font-size: 13px; }

/* ---------- GS Portal ---------- */
.menu .grp { position: relative; }
.menu details { display: inline-block; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 6px; color: #dbeafe; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu details[open] summary { background: rgba(255,255,255,.12); }
.menu details.active summary { background: #fff; color: var(--brand); font-weight: 600; }
.menu .drop { position: absolute; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-width: 210px;
  box-shadow: 0 6px 20px rgba(15, 76, 129, .15); display: flex; flex-direction: column; }
.menu .drop a { color: var(--text); padding: 6px 10px; }
.menu .drop a:hover { background: var(--gray-bg); }
.menu .drop a.active { background: var(--info-bg); color: var(--brand); }
.userbox .who { color: #fff; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { margin: 0; width: 100%; max-width: 380px; }
.login-box .sub { text-align: center; color: var(--muted); margin: -8px 0 18px; font-size: 13px; }
.login-box .links { display: flex; justify-content: space-between; margin-top: 12px; font-size: 13px; }
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-30%); background: none; border: 0; color: var(--brand-2); cursor: pointer; font-size: 12px; }
.otp-input { font: 600 24px ui-monospace, Consolas, monospace !important; letter-spacing: 8px; text-align: center; }
.temp-pass { font: 600 18px ui-monospace, Consolas, monospace; background: #fff; border: 1px dashed var(--warn); padding: 6px 12px; border-radius: 6px; display: inline-block; }
.matrix th, .matrix td { text-align: center; }
.matrix td.l, .matrix th.l { text-align: left; }
.matrix .mod td { background: #f1f5f9; font-weight: 600; text-align: left; }
.form-grid { display: grid; grid-template-columns: 180px 1fr; gap: 10px 14px; align-items: center; max-width: 760px; }
.form-grid label { color: var(--muted); font-size: 13px; }
.form-grid input[type=text], .form-grid input[type=email], .form-grid input[type=password], .form-grid textarea, .form-grid select { width: 100%; }
input[type=email], input[type=number] { font: inherit; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; }
.err { color: var(--err); font-size: 12px; }
.progress { height: 10px; background: var(--gray-bg); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--brand-2); transition: width .4s; }
.batch-log { max-height: 260px; overflow: auto; font-size: 12px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
