/* ──────────────────────────────────────────────────────────────
   Webmail · tema bersih biru-putih
   Warna utama diatur dari config.php (--brand). Semua turunan
   (tint, garis, teks) dihitung otomatis, jadi hijau-putih pun cukup
   mengganti satu nilai.
   ────────────────────────────────────────────────────────────── */

:root {
  --brand: #1D4ED8;
  --brand-ink: color-mix(in srgb, var(--brand) 78%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 8%, #fff);
  --brand-softer: color-mix(in srgb, var(--brand) 3.5%, #fff);
  --brand-line: color-mix(in srgb, var(--brand) 24%, #fff);

  --ink: #0F1B2D;
  --ink-2: #44546A;
  --ink-3: #7A889C;
  --line: #E5EAF2;
  --canvas: #F5F8FC;
  --paper: #fff;
  --danger: #C8344B;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;

  --rail: 264px;
  --list: 396px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font: 400 15px/1.5 var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── Tombol ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 10px;
  font-weight: 600; font-size: 14px; white-space: nowrap;
  background: transparent;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not([disabled]) { background: var(--brand-ink); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn-quiet { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { border-color: var(--brand-line); background: var(--brand-softer); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { height: 48px; border-radius: 12px; font-size: 15px; }

.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-ink); }
.icon-btn.on { color: var(--brand); background: var(--brand-soft); }

.link-btn {
  border: 0; background: none; padding: 4px 6px; border-radius: 6px;
  color: var(--brand); font-weight: 600; font-size: 13px;
}
.link-btn:hover { background: var(--brand-soft); }

.spacer { flex: 1; }

/* ── Avatar ─────────────────────────────────────────────────── */

.av {
  --h: 220;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; letter-spacing: .01em;
  background: hsl(var(--h) 72% 94%);
  color: hsl(var(--h) 58% 32%);
}
.av.lg { width: 46px; height: 46px; font-size: 15px; }
.av.sm { width: 34px; height: 34px; font-size: 12px; }

/* ── Halaman masuk ──────────────────────────────────────────── */

.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--paper); }
.login-main { display: grid; place-items: center; padding: 40px 28px; }
.login-box { width: 100%; max-width: 380px; }
.login-logo { display: block; max-height: 44px; max-width: 200px; margin: 0 0 44px; }
.login-wordmark { font-size: 22px; font-weight: 700; margin-bottom: 44px; color: var(--brand-ink); }
.login h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.lede { margin: 0 0 32px; color: var(--ink-2); }

.field { display: block; margin-bottom: 18px; }
.field > span:first-child { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .pw input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .pw input:hover { border-color: #cdd7e6; }
.field input:focus, .pw input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.pw { position: relative; display: block; }
.pw input { padding-right: 92px; }
.pw-toggle {
  position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--brand); font-weight: 600; font-size: 13px;
}
.pw-toggle:hover { background: var(--brand-soft); }

.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 22px; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }

.form-error {
  margin: -4px 0 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, var(--danger) 8%, #fff); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, #fff);
}

.login-art {
  position: relative; overflow: hidden; color: #fff;
  background: color-mix(in srgb, var(--brand) 86%, #000);
  display: flex; align-items: flex-end; padding: 56px;
}
.login-env { position: absolute; right: -60px; top: 50%; width: min(78%, 560px); transform: translateY(-62%) rotate(-7deg); color: rgba(255, 255, 255, .16); }
.login-art-text { position: relative; max-width: 420px; }
.login-art-name { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
.login-art p { margin: 14px 0 0; font-size: 17px; line-height: 1.5; color: rgba(255, 255, 255, .78); }

/* ── Kerangka aplikasi ──────────────────────────────────────── */

.app {
  height: 100dvh; display: grid;
  grid-template-columns: var(--rail) var(--list) minmax(0, 1fr);
  background: var(--paper);
}

.rail {
  display: flex; flex-direction: column; min-height: 0;
  padding: 20px 14px 14px;
  background: var(--brand-softer); border-right: 1px solid var(--line);
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 20px; font-weight: 700; font-size: 16px; color: var(--ink); min-width: 0; }
.rail-brand img { max-height: 30px; max-width: 150px; }
.rail-brand img + span { display: none; }
.compose-btn { width: 100%; height: 46px; border-radius: 12px; margin-bottom: 18px; font-size: 15px; }

.folders { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; }
.fi {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-2);
  font-weight: 500; text-align: left;
  transition: background-color .15s, color .15s;
}
.fi:hover { background: color-mix(in srgb, var(--brand) 6%, #fff); }
.fi.on { background: #fff; color: var(--brand-ink); font-weight: 650; box-shadow: 0 0 0 1px var(--brand-line); }
.fi .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi .n { font-size: 12px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fi .n.hot { min-width: 22px; height: 22px; padding: 0 7px; display: grid; place-items: center; border-radius: 11px; background: var(--brand); color: #fff; }

.quota { margin: 0 4px 12px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.quota-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--ink-3); }
.quota-top b { font-weight: 650; color: var(--ink-2, #44546A); font-size: 12px; white-space: nowrap; }
.quota-bar { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.quota-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .4s ease; }
.quota.warn .quota-bar i { background: #D97706; }
.quota.full .quota-bar i { background: #DC2626; }
.quota.full .quota-top b { color: #DC2626; }
.rail-foot { display: flex; align-items: center; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.me-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.me-t b { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Daftar email ───────────────────────────────────────────── */

.listpane { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); background: var(--paper); }
.lp-head { display: flex; align-items: center; gap: 6px; padding: 18px 14px 6px 22px; }
.lp-head h2 { flex: 1; margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { display: none; margin-left: -10px; }
.refreshing .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search { position: relative; margin: 8px 18px 4px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 42px; padding: 0 14px 0 40px;
  border: 1px solid transparent; border-radius: 12px; background: var(--canvas);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); }

.chips { display: flex; gap: 6px; padding: 10px 18px 12px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px;
  background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chips button:hover { border-color: var(--brand-line); }
.chips button.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }

.list { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line); overscroll-behavior: contain; }

.mi {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 13px;
  padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background-color .12s;
}
.mi:hover { background: var(--brand-softer); }
.mi.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.mi-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mi-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-weight: 500; }
.mi-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 14px; }
.mi.unread .mi-from { color: var(--ink); font-weight: 700; }
.mi.unread .mi-subj { color: var(--ink); font-weight: 600; }
.mi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.mi-side time { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mi.unread .mi-side time { color: var(--brand); font-weight: 650; }
.star { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: #b9c3d3; }
.star .ic { width: 17px; height: 17px; }
.star:hover { color: #E0A100; background: color-mix(in srgb, #E0A100 10%, #fff); }
.star.on { color: #E0A100; }
.star.on .ic { fill: currentColor; }
.mi .dot { position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--brand); }

.more { display: block; width: calc(100% - 36px); margin: 14px 18px 18px; }

.empty { display: grid; place-items: center; text-align: center; padding: 56px 32px; color: var(--ink-3); }
.empty .ic { width: 38px; height: 38px; stroke-width: 1.4; margin-bottom: 14px; color: var(--brand-line); }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 16px; }
.empty p { margin: 0; max-width: 260px; }

.sk { display: grid; grid-template-columns: 40px 1fr; gap: 13px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sk i { display: block; border-radius: 8px; background: var(--canvas); animation: pulse 1.3s ease-in-out infinite; }
.sk i:first-child { width: 40px; height: 40px; border-radius: 50%; grid-row: span 2; }
.sk i:nth-child(2) { height: 12px; width: 46%; }
.sk i:nth-child(3) { height: 12px; width: 82%; }
@keyframes pulse { 50% { opacity: .45; } }

/* ── Pembaca ────────────────────────────────────────────────── */

.readerpane { min-width: 0; min-height: 0; background: var(--paper); display: flex; }
.reader { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; overscroll-behavior: contain; }

.rd-empty { margin: auto; text-align: center; color: var(--ink-3); padding: 32px; }
.rd-empty .ic { width: 52px; height: 52px; stroke-width: 1.2; color: var(--brand-line); margin-bottom: 14px; }
.rd-empty b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 4px; }

.rd-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 12px 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.rd-bar .back { display: none; margin-left: -8px; margin-right: 4px; }
.rd-bar .vsep { width: 1px; height: 22px; background: var(--line); margin: 0 8px; }

.rd-head { padding: 26px 32px 0; }
.rd-subject { margin: 0 0 22px; font-size: 24px; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.rd-from { display: flex; align-items: flex-start; gap: 14px; }
.rd-who { flex: 1; min-width: 0; }
.rd-name { font-weight: 700; }
.rd-mail { color: var(--ink-3); font-size: 13.5px; overflow-wrap: anywhere; }
.rd-date { color: var(--ink-3); font-size: 13px; white-space: nowrap; padding-top: 2px; }
.rd-to { margin-top: 2px; color: var(--ink-3); font-size: 13.5px; }
.rd-to button { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: 13.5px; }
.rd-to button:hover { color: var(--brand); }
.rd-detail { margin: 10px 0 0 60px; padding: 12px 14px; border-radius: 12px; background: var(--canvas); color: var(--ink-2); font-size: 13.5px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.rd-detail dt { color: var(--ink-3); }
.rd-detail dd { margin: 0; overflow-wrap: anywhere; }

.rd-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 32px 0; }
.att {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; height: 44px; padding: 0 14px 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px;
  transition: border-color .15s, background-color .15s;
}
.att:hover { border-color: var(--brand-line); background: var(--brand-softer); }
.att .ic { color: var(--brand); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.att small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

.rd-img-note { display: flex; align-items: center; gap: 12px; margin: 18px 32px 0; padding: 10px 14px; border-radius: 12px; background: var(--brand-softer); border: 1px solid var(--brand-line); font-size: 13.5px; color: var(--ink-2); }
.rd-img-note .ic { color: var(--brand); width: 18px; height: 18px; }
.rd-img-note span { flex: 1; }

.rd-body { padding: 22px 32px 40px; }
.rd-frame { display: block; width: 100%; border: 0; height: 120px; background: #fff; }
.rd-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 32px 44px; }

/* ── Penulis email ──────────────────────────────────────────── */

.cmp { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(15, 27, 45, .42); animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.cmp-card {
  width: min(780px, calc(100vw - 32px)); height: min(740px, calc(100dvh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: var(--r-l);
  box-shadow: 0 28px 90px rgba(15, 27, 45, .3);
  animation: rise .26s var(--ease);
}
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }
.cmp-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 12px; border-bottom: 1px solid var(--line); }
.cmp-head h3 { margin: 0 0 0 4px; font-size: 16px; font-weight: 700; }

.cmp-fields { padding: 4px 22px 0; }
.frow { display: flex; align-items: flex-start; gap: 12px; min-height: 46px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.frow > label { flex: none; width: 58px; padding-top: 8px; color: var(--ink-3); font-size: 13.5px; font-weight: 500; }
.frow > input { flex: 1; min-width: 0; height: 34px; border: 0; background: none; font-weight: 500; }
.frow > input:focus { outline: none; }
.frow > input::placeholder { color: #a6b2c3; font-weight: 400; }
.frow > .link-btn { margin-top: 3px; }

.chipbox { position: relative; flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chipbox input { flex: 1; min-width: 140px; height: 34px; border: 0; background: none; }
.chipbox input:focus { outline: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 30px; padding: 0 4px 0 12px; border-radius: 15px; background: var(--brand-soft); color: var(--brand-ink); font-size: 13.5px; font-weight: 550; }
.chip.bad { background: color-mix(in srgb, var(--danger) 10%, #fff); color: var(--danger); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 11px; background: transparent; color: inherit; opacity: .7; }
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, .06); }
.chip .ic { width: 13px; height: 13px; }

.suggest { position: absolute; left: 0; top: 100%; z-index: 5; min-width: 280px; max-width: 100%; margin-top: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 14px 40px rgba(15, 27, 45, .16); }
.suggest button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; text-align: left; line-height: 1.3; }
.suggest button:hover, .suggest button.on { background: var(--brand-soft); }
.suggest b { font-size: 14px; font-weight: 600; }
.suggest small { color: var(--ink-3); font-size: 12.5px; }

.cmp-editor {
  flex: 1; min-height: 160px; overflow-y: auto; padding: 18px 24px 24px; outline: none;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 11pt; line-height: 1.35; color: #000;
}
.cmp-editor p, .cmp-editor div { margin: 0; }
.cmp-editor blockquote { margin: 0 0 0 .8ex; padding-left: 1ex; border-left: 2px solid #ccc; }
.cmp-editor a { color: #0563C1; }
.cmp-editor img { max-width: 100%; height: auto; }
.cmp-editor ul, .cmp-editor ol { margin: 0 0 0 24px; padding: 0; }

.cmp-files { list-style: none; margin: 0; padding: 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-files:not(:empty) { padding-bottom: 12px; }
.cmp-files li { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; background: var(--canvas); }
.cmp-files li small { color: var(--ink-3); }
.cmp-files li button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-3); }
.cmp-files li button:hover { background: #fff; color: var(--danger); }
.cmp-files .ic { width: 15px; height: 15px; }

.cmp-foot { border-top: 1px solid var(--line); padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.fmt { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.fmt .sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.linkbar { display: flex; gap: 8px; padding: 8px 4px 2px; }
.linkbar input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.linkbar input:focus { outline: none; border-color: var(--brand); }

/* ── Dialog & notifikasi ────────────────────────────────────── */

.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(15, 27, 45, .42); animation: fade .15s ease-out; }
.modal-card { width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; border-radius: var(--r-l); background: #fff; box-shadow: 0 28px 90px rgba(15, 27, 45, .3); animation: rise .22s var(--ease); }
.modal-card h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; }
.modal-card > p { margin: 0 0 22px; color: var(--ink-2); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.modal-card .field { margin-bottom: 14px; }
.modal-card .field input[type="text"], .modal-card .field input[type="tel"] { height: 44px; }
.modal-card .check { margin: 2px 0 14px; }
.sig-preview { margin: 4px 0 20px; padding: 16px; border: 1px dashed var(--brand-line); border-radius: 12px; background: var(--brand-softer); overflow-x: auto; }
.sig-preview img { max-width: 72px; height: auto; }
.sig-label { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }

.toasts { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 12px 34px rgba(15, 27, 45, .28); animation: rise .24s var(--ease); pointer-events: auto; }
.toast.err { background: var(--danger); }
.toast .ic { width: 18px; height: 18px; }

.fab { display: none; }
.scrim { display: none; }

/* ── Tablet: sidebar jadi laci ──────────────────────────────── */

@media (max-width: 1100px) {
  .app { grid-template-columns: var(--list) minmax(0, 1fr); }
  .rail {
    position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .28s var(--ease);
    box-shadow: 0 0 60px rgba(15, 27, 45, .22);
    padding-top: max(20px, env(safe-area-inset-top));
  }
  .app.drawer .rail { transform: none; }
  .app.drawer .scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(15, 27, 45, .4); animation: fade .2s; }
  .menu-btn { display: grid; }
}

/* ── Ponsel: satu kolom, pembaca menggeser dari kanan ───────── */

@media (max-width: 820px) {
  .app { display: block; position: relative; overflow: hidden; }
  .listpane { position: absolute; inset: 0; border-right: 0; }
  .readerpane {
    position: absolute; inset: 0; z-index: 10;
    transform: translateX(100%); transition: transform .3s var(--ease);
  }
  .app.show-reader .readerpane { transform: none; }
  .rd-bar { padding: max(10px, env(safe-area-inset-top)) 10px 10px; }
  .rd-bar .back { display: grid; }
  .rd-head { padding: 20px 18px 0; }
  .rd-subject { font-size: 21px; margin-bottom: 18px; }
  .rd-detail { margin-left: 0; }
  .rd-date { display: none; }
  .rd-mobdate { display: block !important; }
  .rd-atts { padding: 16px 18px 0; }
  .rd-img-note { margin: 16px 18px 0; }
  .rd-body { padding: 18px 18px 32px; }
  .rd-actions { padding: 0 18px calc(32px + env(safe-area-inset-bottom)); }

  .lp-head { padding-top: max(16px, env(safe-area-inset-top)); padding-left: 14px; }
  .list { padding-bottom: 96px; }

  .fab {
    position: fixed; z-index: 20; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; display: grid; place-items: center;
    border: 0; border-radius: 18px; background: var(--brand); color: #fff;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--brand) 42%, transparent);
    transition: transform .15s var(--ease);
  }
  .fab:active { transform: scale(.94); }
  .fab .ic { width: 24px; height: 24px; }
  .app.show-reader .fab { display: none; }

  .cmp { background: #fff; display: block; }
  .cmp-card { width: 100vw; height: 100dvh; border-radius: 0; box-shadow: none; animation: slideup .28s var(--ease); }
  @keyframes slideup { from { transform: translateY(24px); opacity: 0; } }
  .cmp-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .cmp-head #cmpDraft { display: none; }
  .cmp-fields { padding: 0 16px; }
  .cmp-editor { padding: 16px; }
  .cmp-files { padding: 0 16px; }
  .frow > label { width: 52px; }

  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
  body.reading .toasts { bottom: calc(24px + env(safe-area-inset-bottom)); }

  .login { display: block; }
  .login-art { display: none; }
  .login-main { min-height: 100dvh; align-items: start; padding: max(48px, env(safe-area-inset-top)) 22px 32px; }
  .login-logo, .login-wordmark { margin-bottom: 34px; }
}

.rd-mobdate { display: none; margin-top: 6px; color: var(--ink-3); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
