/* Panel admin - mobile-first */
:root {
  --accent: #0f766e; --accent-dark: #0b5952; --accent-soft: #e7f1f0; --accent-text: #0f766e; --on-accent: #fff;
  --bg: #f4f6f8; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --radius: 12px; --sb: 260px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--accent-text); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.d-block { display: block; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; }

.btn { display: inline-flex; align-items: center; gap: .4em; padding: .55em 1em; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; white-space: nowrap; }
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .35em .75em; font-size: .85rem; min-height: 34px; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: #eef2f6; }
.icon-btn.danger { color: #dc2626; }
.input { width: 100%; padding: .6em .8em; border: 1px solid #d1d5db; border-radius: 10px; font: inherit; font-size: 16px; background: #fff; color: var(--text); min-height: 42px; }
.input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
textarea.input { resize: vertical; }
select.input { width: auto; max-width: 100%; }
.field select.input { width: 100%; }
.field { margin-bottom: 4px; }
.field label, .field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.help { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.req { color: #dc2626; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.check.small { font-size: .85rem; margin-top: 6px; }
.readonly { padding: .6em .8em; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; min-height: 42px; overflow-wrap: anywhere; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: grid; place-items: center; padding: 0 10px; background: #f1f5f9; border: 1px solid #d1d5db; border-right: 0; border-radius: 10px 0 0 10px; font-weight: 600; color: var(--muted); }
.input-prefix .input { border-radius: 0 10px 10px 0; }
.upload-box { display: grid; gap: 8px; }
.thumb-preview { max-height: 160px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.file-link { display: inline-flex; gap: 6px; align-items: center; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 60px; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.accent-preview { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.accent-link { color: var(--accent-text); font-weight: 600; }
.badge-accent { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; padding: 8px; color: var(--muted); }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; max-width: 220px; }

.alert { display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.alert .ic { margin-top: 3px; }
.alert-success { background: #ecfdf3; border-color: #a7f3c4; color: #14532d; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #f1f5f9; color: #475569; }
.badge-success, .badge-published, .badge-selesai { background: #dcfce7; color: #166534; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-baru { background: #fee2e2; color: #991b1b; }
.badge-diproses, .badge-berjalan { background: #fef3c7; color: #92400e; }
.badge-rencana { background: #e0f2fe; color: #075985; }
.badge-ditolak { background: #e5e7eb; color: #374151; }
.stars { color: #f59e0b; letter-spacing: 1px; }
.stars .off { color: #e5e7eb; }

/* Kerangka */
.admin-wrap { min-height: 100vh; }
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sb); background: #0f172a; color: #cbd5e1; overflow-y: auto; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
.sidebar.open { transform: none; }
.sb-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; display: none; }
.sb-backdrop.show { display: block; }
.sb-head { display: flex; gap: 10px; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-head img { background: #fff; border-radius: 8px; padding: 3px; object-fit: contain; }
.sb-head strong { display: block; color: #fff; font-size: .95rem; line-height: 1.2; }
.sb-head small { color: #94a3b8; font-size: .75rem; }
.sb-nav { padding: 10px 10px 30px; }
.sb-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #cbd5e1; text-decoration: none; font-size: .92rem; }
.sb-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-nav a.active { background: var(--accent); color: var(--on-accent); }
.sb-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 16px 12px 6px; font-weight: 700; }
.count { margin-left: auto; background: #ef4444; color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.1rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px; border-radius: 10px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1); padding: 8px; min-width: 200px; z-index: 50; }
.menu-pop .muted { padding: 4px 10px 8px; }
.menu-pop a, .menu-pop button { display: flex; gap: 8px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: #f1f5f9; }
.content { padding: 16px; max-width: 1200px; }

/* Kartu & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.p0 { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; color: var(--text); text-decoration: none; }
.stat strong { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat small { color: var(--muted); font-size: .78rem; line-height: 1.3; display: block; }
.stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.stat-ic.warn { background: #fee2e2; color: #b91c1c; }
.col-chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 10px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.col .bar { width: 100%; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; opacity: .85; }
.col small { font-size: .65rem; color: var(--muted); }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.simple-list li:last-child { border-bottom: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }

/* Daftar & tabel */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.search-box { position: relative; flex: 1 1 200px; max-width: 320px; }
.search-box .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 34px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #f8fafc; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table a { text-decoration: none; }
.inline { display: inline; }
.list-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: #f1f5f9; color: #94a3b8; }
.mini-bar { width: 70px; height: 6px; background: #e5e7eb; border-radius: 9px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--accent); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty > .ic { width: 42px; height: 42px; opacity: .4; }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--text); }
.pagination .current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Tabel jadi kartu di HP */
@media (max-width: 720px) {
  .table-list thead { display: none; }
  .table-list, .table-list tbody, .table-list tr, .table-list td { display: block; width: 100%; }
  .table-list tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table-list td { border: 0; padding: 3px 0; text-align: left !important; display: flex; gap: 10px; align-items: center; }
  .table-list td::before { content: attr(data-label); min-width: 90px; font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
  .table-list td.actions { justify-content: flex-end; width: 100%; padding-top: 6px; }
  .table-list td.actions::before { content: none; }
}

/* Formulir */
.back-link { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; padding-bottom: 4px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a.active { color: var(--accent-text); border-color: var(--accent); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form .input { width: auto; flex: 0 1 260px; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 10px; }
.secret-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.secret-box code { font-size: 1.05rem; padding: 8px 12px; letter-spacing: .05em; }

/* Editor teks */
.rte { border: 1px solid #d1d5db; border-radius: 10px; overflow: hidden; background: #fff; }
.rte:focus-within { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #f8fafc; position: sticky; top: 56px; z-index: 5; }
.rte-bar button { min-width: 34px; height: 34px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; font: inherit; font-weight: 700; font-size: .85rem; color: var(--text); padding: 0 8px; }
.rte-bar button:hover, .rte-bar button.on { background: #e2e8f0; }
.rte-bar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
.rte-area { min-height: 260px; padding: 14px; outline: 0; line-height: 1.7; font-size: 16px; overflow-wrap: break-word; }
.rte-area img { max-width: 100%; border-radius: 8px; }
.rte-area blockquote { border-left: 4px solid var(--accent); margin: 1em 0; padding: 6px 14px; background: #f8fafc; }
.rte-area .embed { aspect-ratio: 16/9; background: #000; position: relative; }
.rte-area .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rte-src { width: 100%; min-height: 260px; border: 0; padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; display: none; }
.rte.source .rte-area { display: none; }
.rte.source .rte-src { display: block; }

/* Login */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
.auth-card { background: #fff; padding: 28px 22px; border-radius: 18px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.2); text-align: center; }
.auth-card form { text-align: left; margin: 18px 0; display: grid; gap: 12px; }
.auth-logo { margin: 0 auto 10px; object-fit: contain; }
.auth-icon .ic { width: 48px; height: 48px; color: var(--accent-text); }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 4px; }

.hide-sm { display: none; }
@media (min-width: 600px) {
  .hide-sm { display: inline; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid > .field:not(.half), .form-grid > .form-actions, .form-grid > .field-check:not(.half) { grid-column: 1 / -1; }
}
@media (min-width: 1000px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--sb); }
  .only-mobile { display: none !important; }
  .content { padding: 24px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .rte-bar { top: 57px; }
}

/* Kotak akun demo di halaman login */
.demo-login { text-align: left; background: #fffbeb; border: 1px dashed #f59e0b; border-radius: 12px; padding: 12px 14px; margin: 14px 0 0; display: grid; gap: 4px; font-size: .9rem; }
.demo-login .btn { justify-self: start; margin-top: 6px; }
.quick form { display: inline; }
