/* e-Mesyuarat IKN - token DBD. Palette ialah cadangan; tukar nilai di :root bila warna rasmi IKN ada. */
:root {
  --primary: #0F4C81; --primary-hover: #0B3A64; --on-primary: #FFFFFF;
  --secondary: #0E7490;
  --bg: #F5F7FA; --surface: #FFFFFF; --border: #D5DBE3;
  --text: #1F2933; --muted: #52606D;
  --success: #1B7F4B; --warning: #B45309; --danger: #B42318; --info: #1D4ED8;
  --focus: #2563EB;
  --tint: #E6EEF7; --thead: #EEF2F6; --row-hover: #F5F7FA; --skeleton: #E4E9EF;
  --shadow-card: 0 1px 2px rgba(0,0,0,.08); --shadow-modal: 0 8px 24px rgba(0,0,0,.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 56px; --side-w: 240px; --bottom-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --primary: #60A5FA; --primary-hover: #93C5FD; --on-primary: #0B1220;
  --secondary: #22D3EE;
  --bg: #0F172A; --surface: #1E293B; --border: #334155;
  --text: #E5E7EB; --muted: #A8B3C2;
  --success: #4ADE80; --warning: #FBBF24; --danger: #F87171; --info: #93C5FD;
  --focus: #93C5FD;
  --tint: #1E3A5F; --thead: #273449; --row-hover: #243247; --skeleton: #2A3850;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4); --shadow-modal: 0 8px 24px rgba(0,0,0,.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #60A5FA; --primary-hover: #93C5FD; --on-primary: #0B1220;
    --secondary: #22D3EE;
    --bg: #0F172A; --surface: #1E293B; --border: #334155;
    --text: #E5E7EB; --muted: #A8B3C2;
    --success: #4ADE80; --warning: #FBBF24; --danger: #F87171; --info: #93C5FD;
    --focus: #93C5FD;
    --tint: #1E3A5F; --thead: #273449; --row-hover: #243247; --skeleton: #2A3850;
    --shadow-card: 0 1px 2px rgba(0,0,0,.4); --shadow-modal: 0 8px 24px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.55 var(--font); background: var(--bg); color: var(--text); }
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 28px; line-height: 1.25; font-weight: 700; }
h2 { font-size: 22px; line-height: 1.3; font-weight: 600; }
h3 { font-size: 18px; line-height: 1.35; font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 1.45; }
.lead { font-size: 17px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }
[hidden] { display: none !important; }
.noscript { padding: 16px; background: var(--surface); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- Butang ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font: 600 16px/1 var(--font); cursor: pointer; text-decoration: none; background: none; color: inherit; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { border-color: var(--secondary); color: var(--secondary); background: transparent; }
.btn-secondary:hover:not(:disabled) { background: var(--tint); }
.btn-ghost { color: var(--primary); }
.btn-ghost:hover:not(:disabled) { background: var(--tint); }
.btn-danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #0B1220; } }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.is-loading::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--tint); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Borang ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 400 16px/1.4 var(--font); }
textarea.input { resize: vertical; min-height: 120px; }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; }
.input[readonly] { background: var(--thead); color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--danger); font-size: 14px; margin: 6px 0 0; }

/* ---------- Badge, banner ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; font-size: 14px; font-weight: 600; line-height: 1.45; white-space: nowrap; }
.badge-success { color: var(--success); } .badge-warning { color: var(--warning); } .badge-danger { color: var(--danger); }
.badge-info { color: var(--info); } .badge-muted { color: var(--muted); } .badge-teal { color: var(--secondary); }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 8px; border: 1px solid; margin: 12px 0; }
.banner > span { flex: 1; }
.banner-danger { border-color: var(--danger); color: var(--danger); background: var(--surface); }
.banner-ok { border-color: var(--success); color: var(--success); background: var(--surface); }

/* ---------- Kad, layout halaman ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: var(--shadow-card); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.toolbar .input:first-child { flex: 1 1 240px; }
.toolbar select.input { flex: 0 1 220px; width: auto; min-width: 140px; max-width: 100%; }
.empty { text-align: center; padding: 24px 8px; }
.empty-title { font-weight: 600; margin-bottom: 4px; }
.skeleton-list { display: grid; gap: 8px; }
.skeleton { height: 48px; border-radius: 8px; background: var(--skeleton); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Jadual (jadi kad < 640px) ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; background: var(--thead); text-align: left; font-weight: 600; padding: 10px 12px; white-space: nowrap; }
.table td { padding: 8px 12px; border-top: 1px solid var(--border); height: 48px; vertical-align: middle; }
.table tbody tr:hover { background: var(--row-hover); }
.row-actions { display: flex; gap: 4px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
@media (max-width: 639px) {
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; box-shadow: var(--shadow-card); }
  .table td { border: 0; height: auto; padding: 6px 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 14px; text-align: left; flex: none; }
}

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.6); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow-modal); margin: auto 0; }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0 24px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 24px; }
.skip-list { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast-root { position: fixed; z-index: 60; top: calc(var(--header-h) + 8px); right: 12px; display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); }
@media (max-width: 639px) { .toast-root { right: 50%; transform: translateX(50%); } }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 16px; background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; box-shadow: var(--shadow-modal); }
.toast-msg { flex: 1; }
.toast-success { border-left-color: var(--success); } .toast-success .icon:first-child { color: var(--success); }
.toast-error { border-left-color: var(--danger); } .toast-error .icon:first-child { color: var(--danger); }

/* ---------- Shell ---------- */
.app-header { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: var(--on-primary); }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 12px; }
.header-right { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font: 600 15px/1 var(--font); cursor: pointer; max-width: 240px; min-width: 44px; justify-content: center; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 639px) { .user-name { display: none; } .user-btn { padding: 0 10px; } }
.popover { position: absolute; right: 0; top: calc(100% + 6px); width: 300px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-modal); padding: 12px; display: grid; gap: 8px; }
.popover-who { display: grid; font-size: 14px; word-break: break-all; }
.popover-label { margin: 4px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.theme-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font: 400 14px/1.2 var(--font); cursor: pointer; }
.theme-opt.is-on { background: var(--tint); border-color: var(--primary); font-weight: 600; }

.sidenav { position: fixed; z-index: 20; top: var(--header-h); bottom: 0; left: 0; width: var(--side-w); padding: 12px; background: var(--surface); border-right: 1px solid var(--border); display: none; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--text); font: 500 16px/1.2 var(--font); text-decoration: none; cursor: pointer; text-align: left; }
.nav-link:hover { background: var(--row-hover); }
.nav-link.is-active { background: var(--tint); border-left-color: var(--primary); color: var(--primary); font-weight: 600; }
.bottombar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--bottom-h); display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.bottombar .nav-link { flex-direction: column; justify-content: center; gap: 2px; padding: 4px; border-left: 0; border-radius: 0; font-size: 13px; min-width: 0; }
.bottombar .nav-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bottombar .nav-link.is-active { border-top: 3px solid var(--primary); }
.more-list { display: grid; gap: 8px; }
.main { margin: 0; padding: calc(var(--header-h) + 16px) 16px calc(var(--bottom-h) + 24px); max-width: 1200px; outline: none; }
@media (min-width: 640px) {
  .sidenav { display: flex; }
  .bottombar { display: none; }
  .main { margin-left: var(--side-w); padding: calc(var(--header-h) + 24px) 24px 48px; max-width: none; }
  .main > * { max-width: 1200px; }
  .main > .table-wrap, .main > .toolbar, .main > .pager { max-width: 1200px; }
}
@media (max-width: 639px) { h1 { font-size: 24px; } h2 { font-size: 20px; } }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; outline: none; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-card); padding: 32px 24px; text-align: center; }
.login-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.login-btn { display: flex; justify-content: center; margin: 24px 0 12px; min-height: 44px; }
.login-msg { text-align: left; }
.conn { margin: 16px 0 0; font-size: 14px; }
.conn-ok { color: var(--success); } .conn-bad { color: var(--danger); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; } }

/* ---------- Cetak ---------- */
@media print {
  .app-header, .sidenav, .bottombar, .toast-root, .skip-link, .btn, .icon-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .main { margin: 0; padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #999; }
}

/* ---------- Fasa 2: mesyuarat ---------- */
.section { margin-bottom: 16px; }
.center { text-align: center; }
.back { margin: 0 0 8px; font-size: 14px; }
.back a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.banner-info { border-color: var(--info); color: var(--info); background: var(--surface); }

.mcard-list { display: grid; gap: 8px; margin-bottom: 8px; }
.mcard { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-card); color: var(--text); text-decoration: none; min-height: 72px; }
.mcard:hover { border-color: var(--primary); }
.mcard-date { flex: none; width: 56px; text-align: center; border-right: 1px solid var(--border); padding-right: 16px; }
.mcard-day { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--primary); }
.mcard-month { display: block; font-size: 14px; color: var(--muted); text-transform: uppercase; }
.mcard-body { flex: 1; min-width: 0; }
.mcard-title { margin: 0; font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.mcard-meta { margin: 2px 0 6px; }
.mcard-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-btn { min-height: 44px; padding: 0 16px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--text); font: 500 16px/1 var(--font); cursor: pointer; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.is-on { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.seg-btn:disabled { opacity: .5; cursor: not-allowed; }
.seg + .toolbar, .seg { margin-bottom: 4px; }

.detail-head .page-head { align-items: flex-start; }
.detail-head h1 { overflow-wrap: anywhere; }
.meta { margin: 8px 0 12px; display: grid; gap: 4px; }
.meta-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 639px) { .meta-row { grid-template-columns: 1fr; gap: 0; } .meta dt { font-size: 14px; } }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 16px 0 0; }
.tab { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: 500 16px/1 var(--font); cursor: pointer; }
.tab.is-on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabpanel { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }

.agenda-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.agenda-item { display: flex; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.agenda-item:last-child { border-bottom: 0; padding-bottom: 0; }
.agenda-seq { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.agenda-title { margin: 0 0 2px; font-weight: 600; font-size: 17px; }
.agenda-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; }
.att-mine { margin-bottom: 16px; }

.form-wide { max-width: 880px; }
.grid-form { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-form { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.check-row input, .picker-row input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.check-row label { font-weight: 400; margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 16px 0 32px; }
@media (max-width: 639px) { .form-actions .btn { flex: 1 1 100%; } }

.picker-count { margin: 6px 0; }
.picker-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.picker-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.picker-row:last-of-type { border-bottom: 0; }
.picker-row:hover { background: var(--row-hover); }
.picker-text { display: grid; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.picker-empty { padding: 12px; margin: 0; }

/* ---------- Fasa 3: gambar, bahan, agenda ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--tint); color: var(--primary); font-weight: 700; overflow: hidden; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.name-cell { display: flex; align-items: center; gap: 10px; }
.photo-field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-input { width: 100%; min-height: 44px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 400 16px/1.4 var(--font); }
.file-input::file-selector-button { min-height: 36px; margin-right: 12px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--thead); color: var(--text); font: 600 15px var(--font); cursor: pointer; }
.subhead { margin: 16px 0 4px; font-size: 18px; }
.warn-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--warning); border-radius: 8px; color: var(--warning); font-size: 14px; margin: 8px 0 16px; }
.progress { width: 100%; height: 10px; border-radius: 999px; background: var(--skeleton); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .15s; }

.mat-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.mat-group { margin-bottom: 20px; }
.mat-group h3 { margin: 0 0 8px; font-size: 16px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.mat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mat-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.mat-item.is-old { opacity: .65; background: var(--thead); }
.mat-ico { flex: none; width: 40px; height: 40px; border-radius: 8px; background: var(--tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.mat-body { flex: 1; min-width: 0; }
.mat-title { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mat-title a { color: var(--text); }
.mat-meta { margin: 2px 0 0; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.mat-actions { display: flex; gap: 2px; flex: none; }
@media (max-width: 639px) { .mat-item { flex-wrap: wrap; } .mat-actions { width: 100%; justify-content: flex-end; } }

.agenda-mat { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.agenda-mat a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }

.ag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ag-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.ag-item.is-dragging { opacity: .4; }
.ag-item.is-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.ag-handle { flex: none; cursor: grab; color: var(--muted); padding: 8px 4px; user-select: none; font-size: 20px; line-height: 1; touch-action: none; }
.ag-body { flex: 1; min-width: 0; }
.ag-ctrl { display: flex; gap: 0; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.viewer-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 8px 0; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-frame { width: 100%; height: calc(100vh - 260px); min-height: 420px; border: 1px solid var(--border); border-radius: 8px; background: #E5E7EB; }
.viewer-hint { font-size: 14px; color: var(--muted); }

.grow { flex: 1 1 200px; min-width: 0; }

/* Bar muat naik berjalan (tiada peratus: kemajuan sebenar memerlukan preflight CORS yang Apps Script tolak) */
.progress.is-running > div { width: 35%; animation: progress-run 1.2s ease-in-out infinite; }
@keyframes progress-run { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .progress.is-running > div { width: 100%; animation: none; opacity: .6; } }

.block { display: block; margin-top: 2px; }

/* ---------- Fasa 4: komen & cadangan ---------- */
.cmt { display: grid; gap: 12px; }
.cmt-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.cmt-filters .input { flex: 1 1 160px; width: auto; min-width: 0; }
.cmt-list { display: grid; gap: 10px; }
.cmt-item { padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.cmt-item.is-mine { border-left: 4px solid var(--primary); }
.cmt-head { display: flex; align-items: center; gap: 10px; }
.cmt-who { display: grid; line-height: 1.3; }
.cmt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 4px; }
.cmt-target { margin: 0 0 4px; }
.cmt-text { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-actions { display: flex; justify-content: flex-end; gap: 2px; margin-top: 4px; }
.cmt-composer { border-top: 1px solid var(--border); padding-top: 12px; }
.cmt-form { display: grid; gap: 8px; }
.cmt-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmt-row .input { flex: 1 1 140px; width: auto; min-width: 0; }
.cmt-send { justify-content: space-between; }
.cmt-closed { display: flex; gap: 6px; align-items: center; margin: 0; }
.cmt-compact .cmt-text { font-size: 16px; }
.notes { display: grid; gap: 8px; }
.notes-title { margin: 0; font-size: 16px; }
.notes textarea { min-height: 220px; }
.viewer-comments { margin-top: 16px; }

/* ---------- Fasa 4: Mod Mesyuarat ---------- */
.shell.is-live .app-header, .shell.is-live .sidenav, .shell.is-live .bottombar, .shell.is-live .skip-link { display: none; }
.shell.is-live .main { margin: 0; padding: 0; max-width: none; }
.shell.is-live .main > * { max-width: none; }
.live-root { height: 100vh; height: 100dvh; }
.live { display: flex; flex-direction: column; height: 100%; background: var(--bg); position: relative; overflow: hidden; }
.live-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.live-title { display: grid; flex: 1 1 200px; min-width: 0; line-height: 1.25; }
.live-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-ctrl { display: flex; gap: 8px; }
.live-toggle { display: none; }
.live-banner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--warning); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .live-banner { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .live-banner { color: #0B1220; } }
.live-banner[hidden] { display: none; }
.live-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; }
.live-left, .live-right { overflow-y: auto; background: var(--surface); padding: 12px; }
.live-left { border-right: 1px solid var(--border); }
.live-right { border-left: 1px solid var(--border); }
.live-center { overflow-y: auto; padding: 16px 20px; min-width: 0; }
.live-h { font-size: 18px; margin: 0 0 8px; }
.live-agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.live-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; min-height: 56px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-align: left; font: 500 16px/1.35 var(--font); cursor: pointer; }
.live-item:hover { background: var(--row-hover); }
.live-item.is-selected { border-color: var(--primary); background: var(--tint); }
.live-item.is-current { border-left: 5px solid var(--secondary); }
.live-item-body { display: grid; gap: 4px; min-width: 0; }
.live-item-title { overflow-wrap: anywhere; }
.live-item-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.live-itemtitle { font-size: 24px; line-height: 1.3; font-weight: 600; margin: 0 0 8px; overflow-wrap: anywhere; }
.live-desc { font-size: 17px; margin: 8px 0; }
.live-itemctrl { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.live-follow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 12px; border: 2px solid var(--secondary); border-radius: 8px; background: var(--surface); font-weight: 600; }
.live-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.live-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: 500 15px var(--font); cursor: pointer; max-width: 100%; }
.live-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.live-chips-sep { padding: 0 4px; }
.live-frame { height: calc(100vh - 340px); min-height: 360px; }
.live-tabs { margin: 0 0 12px; }
.live-all { min-height: 36px; margin-bottom: 8px; }
.live-msg { max-width: 560px; margin: 48px auto; padding: 0 16px; text-align: center; }
@media (max-width: 1023px) {
  .live-grid { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
  .live-left, .live-right { position: absolute; top: 0; bottom: 0; width: min(92vw, 380px); z-index: 5; box-shadow: var(--shadow-modal); visibility: hidden; transition: transform .2s; }
  .live-left { left: 0; transform: translateX(-102%); } .live-right { right: 0; transform: translateX(102%); }
  .live[data-panel="left"] .live-left, .live[data-panel="right"] .live-right { transform: none; visibility: visible; }
  .live-toggle { display: inline-flex; }
  .live-frame { height: calc(100vh - 380px); }
}
@media (prefers-reduced-motion: reduce) { .live-left, .live-right { transition: none; } }
@media print { .live-left, .live-right, .live-bar { display: none; } }

/* ---------- Fasa 6: PWA, luar talian, S-14 ---------- */
.offline-bar { position: fixed; z-index: 29; top: var(--header-h); left: 0; right: 0; display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: var(--warning); color: #fff; font-weight: 600; font-size: 15px; }
.offline-bar[hidden] { display: none; }
:root[data-theme="dark"] .offline-bar { color: #0B1220; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .offline-bar { color: #0B1220; } }
@media (min-width: 640px) { .offline-bar { left: var(--side-w); } }
.shell.is-live .offline-bar { top: 0; left: 0; }
.install-banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; margin: 12px 0 16px; border: 1px solid var(--primary); border-radius: 8px; background: var(--tint); }
.install-banner p { margin: 0; flex: 1 1 240px; }
.install-actions { display: flex; gap: 8px; }
.offline-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }

.sys-tabs { margin-bottom: 16px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 16px; }
.stat { flex: 1 1 140px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.stat strong { display: block; font-size: 24px; line-height: 1.2; }
.table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.table .wrap { overflow-wrap: anywhere; max-width: 360px; }
.settings-form { max-width: 720px; }
.settings-form textarea { min-height: 140px; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.shell:has(.offline-bar:not([hidden])) .main { padding-top: calc(var(--header-h) + 64px); }
.shell.is-live:has(.offline-bar:not([hidden])) .main { padding-top: 0; }
