/* Admin portofolio Melinda: copied from the Alwi portfolio admin; coral accent from Melinda's site. */
:root {
  color-scheme: dark;
  --bg: #061019;
  --bg-2: #09151f;
  --surface: #132634;
  --border: rgba(129, 190, 222, .14);
  --border-strong: #56748a;
  --text: #f4f8fb;
  --text-2: #c4d1d9;
  --text-muted: #91a5b4;
  --accent: #f4978b;
  --accent-hover: #f7b0a6;
  --on-accent: #061019;
  --ok: #31e981;
  --warn: #f6c85f;
  --danger: #ff6b6b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { font-size: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--mono); font-size: .875rem; }
pre { background: var(--bg-2); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; margin-top: 8px; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 1.125rem; line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }

.wrap { width: min(100% - 32px, 1240px); margin-inline: auto; }
main.wrap { padding-block: 24px 64px; }
.narrow { max-width: 560px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.skip-link { position: absolute; left: 12px; top: -80px; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--r-md); z-index: 10; }
.skip-link:focus { top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg-2); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border: 1.5px solid var(--text-muted); border-radius: 10px; font-size: .75rem; font-weight: 700; }
.topnav { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); text-decoration: none; }
.topnav a[aria-current] { color: var(--text); box-shadow: inset 0 -2px var(--accent); }
.logout { margin-left: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .9375rem;
  text-decoration: none; cursor: pointer; color: var(--text); background: transparent;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--border-strong); }
.btn-secondary:hover { background: rgba(255, 255, 255, .05); border-color: var(--text-muted); }
.btn-quiet { color: var(--text-2); }
.btn-quiet:hover { color: var(--text); }
.btn-danger { background: var(--danger); color: #1a0606; }
.btn-icon { min-width: 40px; padding: 8px; border-color: var(--border-strong); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.inline-form { display: inline; }

/* Messages */
.flash { margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--ok); border-radius: var(--r-md); color: var(--text); background: rgba(49, 233, 129, .08); }
.alert { padding: 12px 16px; border: 1px solid var(--warn); border-radius: var(--r-md); background: rgba(246, 200, 95, .08); color: var(--text); margin-block: 12px; }
.error-summary { margin-bottom: 24px; padding: 16px 20px; border: 2px solid var(--danger); border-radius: var(--r-md); background: rgba(255, 107, 107, .08); }
.error-summary h2 { font-size: 1rem; margin-bottom: 8px; }
.error-summary ul { padding-left: 1.2em; display: grid; gap: 4px; }
.error-summary a { color: var(--text); }
.notice-box { margin-bottom: 24px; padding: 16px 20px; border: 1px solid var(--border-strong); border-radius: var(--r-md); }
.notice-box h2 { font-size: 1rem; }
.notice-box p + p { margin-top: 8px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.empty { color: var(--text-muted); padding: 24px 0; }
.hint, .meta { color: var(--text-muted); font-size: .875rem; }
.small { font-size: .8125rem; }
.crumbs { color: var(--text-muted); font-size: .875rem; margin-bottom: 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.head-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); font-size: .8125rem; color: var(--text-2); white-space: nowrap; }
.badge-published { border-color: var(--ok); color: var(--ok); }
.badge-draft { border-color: var(--warn); color: var(--warn); }
.badge-archived { color: var(--text-muted); }
.badge-featured { border-color: var(--accent); color: var(--accent); }

/* Tabs */
.tabs { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs a { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; padding: 0 12px; color: var(--text-2); text-decoration: none; }
.tabs a[aria-current] { color: var(--text); box-shadow: inset 0 -2px var(--accent); }
.count { font-family: var(--mono); font-size: .8125rem; color: var(--text-muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: .8125rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.col-title a { font-weight: 600; }
.col-title .mono, .col-title .meta { display: block; font-weight: 400; }
.col-order { white-space: nowrap; width: 1%; }
.col-actions { white-space: nowrap; text-align: right; }
.col-actions .btn, .col-actions form { margin-left: 4px; }
td .badge { margin: 0 4px 4px 0; }
@media (max-width: 860px) {
  .project-table thead { position: absolute; left: -9999px; }
  .project-table tr { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .project-table td, .project-table th { border: 0; padding: 4px 0; }
  .project-table .col-order { grid-row: span 3; }
  .project-table .col-actions { grid-column: 2; text-align: left; white-space: normal; }
  .col-actions .btn, .col-actions form { margin: 0 4px 4px 0; }
}

/* Cards & forms */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
.card + .card { margin-top: 16px; }
.field { display: grid; gap: 4px; margin-top: 16px; border: 0; padding: 0; min-width: 0; }
.card > h2 + .field, .card > .hint + .field { margin-top: 8px; }
label, .label, legend { font-weight: 600; font-size: .9375rem; color: var(--text); }
legend { margin-bottom: 4px; }
.req { font-weight: 400; color: var(--text-muted); font-size: .8125rem; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-md);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=file] { padding: 8px; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .875rem; font-weight: 600; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; min-height: 32px; margin-top: 6px; }
.choice input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.choice.danger { color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); z-index: 2; }

.rows { border: 0; padding: 0; margin-top: 20px; }
.row-list { list-style: none; padding: 0; display: grid; gap: 12px; margin-top: 8px; }
.row-item { padding: 12px 16px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-2); }
.row-item .field:first-child { margin-top: 0; }
.rows > .btn { margin-top: 12px; }

/* Edit layout */
.edit-layout { display: grid; gap: 24px; }
@media (min-width: 1100px) {
  .edit-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .sidebar { position: sticky; top: 16px; }
}
.sidebar .card + .card { margin-top: 16px; }
.action-stack { display: grid; gap: 8px; margin-top: 12px; }
.action-stack .btn { width: 100%; }
.blockers { margin-top: 8px; font-size: .875rem; }
.blockers summary { cursor: pointer; color: var(--text-2); min-height: 32px; }
.blockers ul { padding-left: 1.2em; display: grid; gap: 4px; margin-top: 6px; color: var(--text-2); word-break: break-word; }
.link-stack { list-style: none; padding: 0; display: grid; gap: 4px; margin-bottom: 12px; }
.link-stack a { display: inline-flex; min-height: 36px; align-items: center; }
.danger-link { color: var(--danger); }

/* Images */
.image-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.image-item { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-2); }
.thumb { width: 100%; max-width: 280px; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg); }
.image-fields .field:first-of-type { margin-top: 8px; }
.order-input { display: inline-block; width: 4.5rem !important; min-height: 36px !important; margin-left: 8px; padding: 4px 8px !important; }
@media (min-width: 768px) { .image-item { grid-template-columns: 280px 1fr; } }

.report { padding-left: 1.2em; display: grid; gap: 4px; }
.report code { word-break: break-word; font-size: .8125rem; color: var(--text-2); }
.result { margin-top: 24px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Spacing fixes */
.grid-2 > .card + .card { margin-top: 0; }
.grid-2 > .card { align-self: stretch; }   /* side-by-side cards start level (Build & preview) */
.card > p + form, .card > p + p { margin-top: 12px; }
h1 + .notice-box, h1 + .card, h1 + .grid-2, h1 + .error-summary, h1 + table { margin-top: 20px; }

/* Guide */
.guide { max-width: 860px; }
.guide section { margin-top: 40px; scroll-margin-top: 16px; }
.guide h2 { font-size: 1.25rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.guide h3 { font-size: 1.0625rem; margin-top: 24px; }
.guide p, .guide li { color: var(--text-2); }
.guide p + p, .guide p + dl, .guide dl + p { margin-top: 12px; }
.lead-text { font-size: 1.0625rem; margin-top: 8px; }
.toc { margin-top: 24px; }
.toc ol { padding-left: 1.4em; display: grid; gap: 4px; }
.steps { padding-left: 1.4em; display: grid; gap: 8px; }
.defs { display: grid; gap: 0; margin-top: 12px; }
.defs > div { display: grid; gap: 4px; padding: 12px 0; border-top: 1px solid var(--border); }
.defs dt { font-weight: 600; color: var(--text); }
.defs dd { color: var(--text-2); }
@media (min-width: 768px) { .defs > div { grid-template-columns: 220px 1fr; gap: 16px; } }
.tip { margin-top: 16px; }
.tip ul { padding-left: 1.2em; display: grid; gap: 6px; margin-top: 8px; }
.tip pre { margin: 8px 0; }
.map { margin-top: 16px; font-size: .9375rem; }
.map td, .map th { padding: 10px 8px; }
.map code { word-break: break-word; }
@media (max-width: 767px) {
  .map thead { position: absolute; left: -9999px; }
  .map tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .map td, .map th { border: 0; padding: 2px 0; }
}
.map td:nth-child(2) code { white-space: nowrap; word-break: normal; }

/* Personal documents */
.grid-4 { display: grid; gap: 0 16px; }
@media (min-width: 768px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.checks { display: flex; flex-wrap: wrap; gap: 0 24px; }
.row-item.card { padding: 16px 20px 20px; }
.row-item.card + .row-item.card { margin-top: 0; }
.photo-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar .thumb { max-width: 100%; margin-bottom: 8px; }
/* Align inputs in multi-column rows even when hints differ in height. */
.grid-2, .grid-4 { align-items: end; }
.row-item.grid-2 > .field, .row-item > .grid-2 > .field, .row-item > .grid-4 > .field { margin-top: 12px; }
.row-item.grid-2 > .field:nth-child(-n+2) { margin-top: 0; }
.advanced { margin-top: 20px; }
.advanced summary { cursor: pointer; min-height: 36px; color: var(--text-2); }

/* Melinda admin additions */
.photo-slot { display: grid; gap: 16px; }
.photo-slot + .photo-slot { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.photo-slot .thumb { max-width: 220px; aspect-ratio: 4 / 3; object-fit: cover; }
.thumb-empty { display: grid; place-items: center; max-width: 220px; aspect-ratio: 4 / 3; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--text-muted); font-size: .875rem; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.row-head h3 { margin: 0; }
.order-input { max-width: 90px; }
.warnings { margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--warn); border-radius: var(--r-md); }
.warnings ul { padding-left: 1.2em; margin-top: 6px; color: var(--text-2); }
@media (min-width: 760px) {
  .photo-slot { grid-template-columns: 220px 1fr; align-items: start; }
}
