/* ===================================================================
   CoE AILO — Sistem Permohonan Publikasi
   Tema maroon profesional. Warna disuntik dari pengaturan Admin
   melalui variabel CSS pada partials/head.html.
   =================================================================== */
:root {
  --primary:   #5C1A27;   /* maroon tua  */
  --secondary: #8A2433;   /* maroon terang untuk tautan & hover */
  --accent:    #B0883B;   /* emas, dipakai hemat */
  --cream:     #F5F1EA;   /* kertas hangat (latar) */

  --ink:   #2A2024;
  --muted: #857A7E;
  --line:  #E6DDD3;
  --surface: #FFFFFF;

  --ok:     #2F7D54;
  --ok-bg:  #E7F1EA;
  --warn:   #9A6B1E;
  --warn-bg:#F6EDDA;
  --info:   #3C5A8A;
  --info-bg:#E8EEF7;
  --danger: #A23A3A;
  --danger-bg:#F6E5E5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(40,29,33,.04), 0 6px 20px rgba(40,29,33,.05);
  --shadow-lg: 0 14px 44px rgba(40,29,33,.16);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--secondary); text-decoration: none; }
a:hover { color: var(--primary); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.22; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.005em; }
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

/* ---------------- Layout aplikasi ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--primary);
  color: #ecdfe1; padding: 26px 16px 18px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 30px; }
.brand img { height: 38px; width: auto; border-radius: 8px; background: #fff; padding: 3px; }
.brand .logo-fallback {
  height: 40px; width: 40px; border-radius: 10px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 19px; color: #fff;
}
.brand b { color: #fff; font-family: var(--serif); font-size: 16px; font-weight: 600; line-height: 1.2; }

.nav-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.42); margin: 18px 14px 8px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: #e2cfd2; padding: 9px 14px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500;
  border-left: 2px solid transparent; transition: background .15s, color .15s;
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--accent); }
.nav a.active svg { opacity: 1; color: var(--accent); }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: rgba(255,255,255,.4); padding: 14px 14px 0; border-top: 1px solid rgba(255,255,255,.1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 28px; height: 62px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 12px; }
.who .meta { text-align: right; line-height: 1.25; }
.who .meta .nm { font-weight: 600; font-size: 13.5px; }
.who .meta .rl { font-size: 12px; color: var(--muted); }
.avatar {
  height: 38px; width: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--secondary); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 15px; font-family: var(--serif);
}
.content { padding: 30px 28px 56px; max-width: 1120px; width: 100%; }

/* ---------------- Header halaman ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0 0 3px; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* ---------------- Kartu ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px;
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .card-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.section-gap { margin-top: 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------------- Kartu statistik ---------------- */
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.stat .num { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1; margin-top: 10px; color: var(--primary); }
.stat.s-draft::before { background: var(--muted); }
.stat.s-proc::before  { background: var(--warn); }
.stat.s-pub::before   { background: var(--primary); }

/* ---------------- Tombol (skala proporsional) ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 17px; font-size: 14px; font-weight: 600; font-family: var(--sans);
  background: var(--primary); color: #fff; line-height: 1.1;
  transition: background .15s, border-color .15s, transform .04s; white-space: nowrap;
}
.btn:hover { background: var(--secondary); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: transparent; color: var(--primary); border-color: var(--line); }
.btn.ghost:hover { background: var(--cream); color: var(--primary); border-color: var(--muted); }
.btn.gold { background: var(--accent); color: #3a2c10; }
.btn.gold:hover { background: #9a7531; color: #3a2c10; }
.btn.ok { background: var(--ok); } .btn.ok:hover { background: #266741; }
.btn.danger { background: var(--danger); } .btn.danger:hover { background: #872f2f; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Form ---------------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 16px 0 6px; color: var(--ink); }
label:first-child { margin-top: 0; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=datetime-local],
input[type=file], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input[type=color] { width: 100%; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(138,36,51,.12); }
textarea { resize: vertical; min-height: 88px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

/* ---------------- Tabel ---------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #fbf9f5; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fcfaf6; }
td.col-code { font-family: var(--serif); font-weight: 600; color: var(--primary); white-space: nowrap; }
td.col-action { text-align: right; white-space: nowrap; }
.tw-title { font-weight: 600; }

/* ---------------- Label status ---------------- */
.tag { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.st-draft { background: #ECE7E0; color: #6c635f; }
.st-submitted { background: var(--info-bg); color: var(--info); }
.st-assigned, .st-accepted, .st-in_progress { background: var(--warn-bg); color: var(--warn); }
.st-review { background: #F1E7D3; color: #8a5e16; }
.st-revision { background: var(--danger-bg); color: var(--danger); }
.st-approved { background: var(--ok-bg); color: var(--ok); }
.st-published { background: var(--primary); color: #fff; }

/* ---------------- Alert ---------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #cfe6d8; }
.alert.err { background: var(--danger-bg); color: var(--danger); border-color: #ecd2d2; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #d3e0f0; }

.muted { color: var(--muted); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 16px; color: var(--ink); margin-bottom: 4px; }

/* ---------------- Halaman auth ---------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(176,136,59,.10), transparent),
    radial-gradient(900px 600px at -10% 110%, rgba(92,26,39,.12), transparent),
    var(--cream); }
.auth-card { background: #fff; width: 100%; max-width: 408px; border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 36px 32px; border: 1px solid var(--line); }
.auth-card .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-card h1 { font-size: 23px; margin: 0 0 5px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.pwd-wrap { position: relative; }
.pwd-wrap .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--muted); background: none; border: none; padding: 6px; display: grid; place-items: center; }
.pwd-wrap .eye:hover { color: var(--primary); }
.pwd-wrap input { padding-right: 42px; }
.captcha-box { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.captcha-box img { height: 76px; width: auto; display: block; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.refresh { background: none; border: none; cursor: pointer; color: var(--secondary); font-size: 13px; padding: 0; text-align: left; }
.refresh:hover { color: var(--primary); text-decoration: underline; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; font-size: 13.5px; }

/* ---------------- Timeline ---------------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 22px 26px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 2px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; height: 12px; width: 12px;
  border-radius: 50%; background: #fff; border: 2px solid var(--secondary); }
.timeline li:first-child::before { background: var(--secondary); }
.timeline .t-head { font-weight: 600; font-size: 14.5px; }
.timeline .t-meta { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.timeline .t-note { margin: 6px 0 0; font-size: 14px; }

/* ---------------- Progress ---------------- */
.steps { display: flex; gap: 6px; margin: 4px 0; }
.steps .step { flex: 1; min-width: 0; text-align: center; font-size: 10.5px; color: var(--muted); }
.steps .step .bar { height: 5px; border-radius: 5px; background: var(--line); margin-bottom: 7px; }
.steps .step.done .bar { background: var(--accent); }
.steps .step.current .bar { background: var(--primary); }
.steps .step.current { color: var(--primary); font-weight: 700; }

/* ---------------- Lampiran ---------------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.thumbs img { height: 88px; width: 88px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.filechip { display: inline-flex; align-items: center; gap: 7px; background: var(--cream);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px; margin: 6px 6px 0 0; color: var(--ink); }
.filechip:hover { border-color: var(--secondary); color: var(--primary); }

/* ---------------- Pilih jenis ---------------- */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
.pick a { display: block; padding: 26px 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; transition: border-color .15s, box-shadow .15s, transform .08s; }
.pick a:hover { border-color: var(--secondary); box-shadow: var(--shadow); transform: translateY(-2px); }
.pick .kicker { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.pick h3 { margin: 8px 0 6px; color: var(--primary); font-size: 18px; }
.pick p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------------- Panel aksi ---------------- */
.action-card { border-left: 3px solid var(--accent); }

/* ---------------- Detail meta ---------------- */
.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--muted); font-size: 13.5px; }
.meta-line .code { font-family: var(--serif); font-weight: 600; color: var(--primary); font-size: 15px; }
.field-block { margin-top: 16px; }
.field-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--sans); font-weight: 700; margin-bottom: 4px; }
.kv { margin: 3px 0; } .kv b { color: var(--ink); }

/* ---------------- Topbar mobile ---------------- */
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  width: 38px; height: 38px; cursor: pointer; color: var(--primary); align-items: center; justify-content: center; }
.menu-toggle svg { width: 20px; height: 20px; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(40,29,33,.45); z-index: 40; }

/* ---------------- Responsif ---------------- */
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w) - 4px); top: 0; z-index: 50; transition: left .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .scrim.show { display: block; }
  .menu-toggle { display: inline-flex; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .pick { grid-template-columns: 1fr; }
  .content { padding: 22px 18px 48px; }
  .topbar { padding: 0 18px; }
}
@media (max-width: 460px) {
  .grid.cols-4 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .who .meta { display: none; }
  .stat .num { font-size: 34px; }
}

/* ---------------- Header kartu + tab filter ---------------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.tabs { display: inline-flex; gap: 4px; background: var(--cream); border: 1px solid var(--line); padding: 4px; border-radius: 10px; }
.tab { border: none; background: transparent; cursor: pointer; font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: var(--muted); padding: 6px 13px; border-radius: 7px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(40,29,33,.08); }
.tab-badge { background: var(--warn); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 7px; line-height: 1.5; }
.need-tag { background: var(--warn-bg); color: var(--warn); margin-left: 6px; }

@media (max-width: 560px) {
  .card-head { align-items: flex-start; }
  .tabs { width: 100%; overflow-x: auto; }
}

/* ---------------- Cetak / PDF laporan ---------------- */
.only-print { display: none; }
.print-title { margin-bottom: 16px; }
.print-title h1 { font-size: 22px; margin: 0 0 4px; }
.print-title p { color: var(--muted); margin: 0; font-size: 13px; }
@media print {
  .sidebar, .topbar, .scrim, .no-print { display: none !important; }
  .main { display: block; }
  .content { padding: 0; max-width: 100%; }
  body { background: #fff; font-size: 12px; }
  .card, .stat { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .only-print { display: block; }
  .grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  table { min-width: 0; }
  a { color: var(--ink); }
}

/* ---------------- Jarak tombol aksi setelah kartu ---------------- */
.card + .btn,
.card + .btn-row { margin-top: 20px; }

/* ================= Portal: grid ikon aplikasi ================= */
.portal-hero { text-align: center; padding: 14px 0 28px; }
.portal-hero h1 { font-size: 30px; margin: 0 0 6px; }
.portal-hero p { color: var(--muted); font-size: 15px; margin: 0; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 18px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}
.app-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--secondary); text-decoration: none; color: var(--ink); }
.app-ico {
  width: 62px; height: 62px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--primary), var(--secondary)); color: #fff; margin-bottom: 14px;
}
.app-ico svg { width: 30px; height: 30px; }
.app-tile .nm { font-family: var(--serif); font-weight: 600; font-size: 16px; }
.app-tile .ds { color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }

/* topbar portal (tanpa sidebar) */
.portal-top { background: var(--surface); border-bottom: 1px solid var(--line); height: 64px;
  display: flex; align-items: center; gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 20; }
.portal-top .brand { display: flex; align-items: center; gap: 11px; }
.portal-top .brand img { height: 34px; border-radius: 7px; }
.portal-top .brand .logo-fallback { height: 38px; width: 38px; border-radius: 10px; background: var(--primary);
  color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; }
.portal-top .brand b { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.portal-top .sp { flex: 1; }
.portal-menu { display: flex; align-items: center; gap: 6px; }
.portal-menu a { color: var(--muted); padding: 8px 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; }
.portal-menu a:hover { background: var(--cream); color: var(--primary); text-decoration: none; }
.portal-menu a svg { width: 16px; height: 16px; }
.portal-wrap { max-width: 1080px; margin: 0 auto; padding: 30px 24px 56px; }

.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px,1fr)); gap: 8px; }
.icon-pick label { margin: 0; cursor: pointer; }
.icon-pick input { display: none; }
.icon-opt { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; display: grid; place-items: center; color: var(--muted); }
.icon-pick input:checked + .icon-opt { border-color: var(--secondary); color: var(--primary); background: var(--cream); }
.icon-opt svg { width: 24px; height: 24px; }
