:root {
    --ink: #142433;
    --muted: #5d6d7c;
    --paper: #f3efe7;
    --line: #e3dacb;
    --copper: #b85a2a;
    --danger: #9c2b2b;
    --sidebar: #101820;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Outfit, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
a { color: var(--copper); }
h1, h2 { font-family: Outfit, "Segoe UI", sans-serif; font-weight: 700; letter-spacing: -0.03em; margin: 0; }
button, input, select, textarea { font: inherit; }
.mark { display: inline-flex; gap: 3px; align-items: flex-end; height: 20px; }
.mark i { display: block; width: 4px; background: var(--copper); }
.mark i:nth-child(1) { height: 14px; }
.mark i:nth-child(2) { height: 20px; }
.mark i:nth-child(3) { height: 11px; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at top, #2a3b4c, var(--sidebar) 55%); }
.login-card { width: min(440px, 100%); background: #fffdf9; border-radius: 20px; padding: 1.6rem; }
.side-brand { display: flex; gap: 0.7rem; align-items: center; text-decoration: none; color: inherit; margin-bottom: 1.2rem; }
.side-brand strong { display: block; font-family: Outfit, "Segoe UI", sans-serif; letter-spacing: 0.08em; }
.side-brand small { color: var(--muted); }
.login-card h1 { font-size: 2.2rem; margin-bottom: 0.3rem; }
.login-copy, .demo-note { color: var(--muted); }
.demo-note { font-size: 0.85rem; }
.login-card button, .form-actions button, .button, .admin-user button {
    background: var(--ink);
    color: white;
    border: 0;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.button { display: inline-flex; }

.admin-body { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #f4eee6; padding: 1.2rem 1rem; display: flex; flex-direction: column; }
.sidebar .side-brand { color: white; }
.sidebar .side-brand small { color: #c9b8a6; }
.side-nav { display: grid; gap: 0.35rem; margin-top: 1rem; }
.side-nav a { color: #f4eee6; text-decoration: none; padding: 0.65rem 0.75rem; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; }
.side-nav a.is-active, .side-nav a:hover { background: rgba(255,255,255,0.08); }
.count { background: var(--copper); color: white; border-radius: 999px; min-width: 1.4rem; text-align: center; font-size: 0.75rem; padding: 0.1rem 0.35rem; }
.side-foot { margin-top: auto; }
.side-foot a { color: #e7b89a; }
.admin-main { min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--line); background: #fffdf9; }
.admin-top p { margin: 0; font-family: Outfit, "Segoe UI", sans-serif; font-size: 1.4rem; }
.admin-user { display: flex; align-items: center; gap: 0.8rem; }
.admin-user button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.admin-content { padding: 1.3rem; }
.admin-lead { color: var(--muted); margin: 0 0 1rem; max-width: 720px; }
.page-group { margin-bottom: 1rem; }
.page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.page-grid article { border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem; background: #fff; }
.page-grid strong { display: block; margin-bottom: 0.25rem; }
.page-grid small { display: block; margin-bottom: 0.7rem; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid article, .panel { background: #fffdf9; border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
.stat-grid span, .stat-grid small, .meta, td small { color: var(--muted); display: block; }
.stat-grid strong { font-family: Outfit, "Segoe UI", sans-serif; font-size: 2rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.8rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-block; background: #f3e2d2; color: #8d3f18; border-radius: 999px; padding: 0.1rem 0.45rem; font-size: 0.75rem; font-weight: 700; }
.row-actions, .form-actions { display: flex; gap: 0.8rem; align-items: center; }
.row-actions form, .form-actions form { margin: 0; }
.link-danger { background: none; border: 0; color: var(--danger); padding: 0; cursor: pointer; font-weight: 700; }
label { display: grid; gap: 0.35rem; font-weight: 700; margin-bottom: 0.85rem; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.75rem; background: white; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.check input { width: auto; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.field-error { color: var(--danger); font-size: 0.85rem; }
.alert-success { background: #e5f3ec; color: #1d5c45; border-radius: 12px; padding: 0.75rem 0.9rem; margin-bottom: 0.8rem; }
.empty { color: var(--muted); }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.pager a { font-weight: 700; text-decoration: none; }
.pager-disabled { color: var(--muted); }
.message-body { margin: 1rem 0; white-space: normal; }
.message h2 { margin: 0.3rem 0 0.6rem; font-size: 2rem; }

.alert-error { background: #fbe7e7; color: var(--danger); border-radius: 12px; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.alert-error ul { margin-bottom: 0; }
.homepage-form { display: grid; gap: 1rem; }
.editor-section { padding: 0; overflow: hidden; }
.editor-section > summary { cursor: pointer; padding: 1rem; font-size: 1.1rem; font-weight: 700; background: #fffaf3; }
.editor-section[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.editor-section > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.editor-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.editor-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.editor-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.editor-card legend { float: none; width: auto; padding: 0 0.4rem; font-weight: 700; }
.editor-section h3 { font-size: 1rem; margin: 1rem 0 0.7rem; }
.image-field img { width: 100%; max-width: 240px; height: 130px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #f3efe7; }
.image-field.is-brand img { object-fit: contain; background: #221316; }
.image-field small { color: var(--muted); font-weight: 400; }
.sticky-actions { position: sticky; bottom: 1rem; z-index: 10; display: flex; align-items: center; gap: 1rem; background: #fffdf9; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(20,36,51,.12); padding: 0.8rem 1rem; }
.sticky-actions button { background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: .75rem 1.2rem; font-weight: 700; cursor: pointer; }
.admin-add-btn { display: inline-flex; align-items: center; margin: 0 0 1rem; padding: .65rem 1.1rem; border-radius: 999px; background: var(--iid-theme-primary, #b71923); color: #fff; font-weight: 700; text-decoration: none; }
.is-remove { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; color: var(--danger, #9b1c1c); font-weight: 600; }
.is-remove input { width: auto; }

@media (max-width: 860px) {
    .admin-body, .stat-grid, .stat-grid-4, .field-row, .editor-grid, .editor-grid-3, .editor-grid-4, .page-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .admin-top { align-items: flex-start; flex-direction: column; }
}
