/* ==========================================================================
   LHMSU CMS — the admin side.
   Deliberately quieter than the public site: this is a workroom, not a
   shopfront. Same indigo and orange so it still feels like the same
   institution, but flat surfaces, tight spacing and no decoration.
   ========================================================================== */

:root {
    --indigo:      #1e1246;
    --indigo-deep: #150c33;
    --indigo-soft: #2e1f66;
    --orange:      #f15a22;
    --orange-deep: #d1440f;
    --ink:         #16121f;
    --body:        #3c3a45;
    --muted:       #6f6c7a;
    --line:        #e4e2ec;
    --paper:       #f6f5fa;
    --ok:          #1c7a4d;
    --ok-bg:       #e8f5ee;
    --bad:         #b0343c;
    --bad-bg:      #fbecec;
    --radius:      10px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    font-family: 'Public Sans', system-ui, -apple-system, sans-serif;
    background: var(--paper);
    color: var(--body);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Archivo', sans-serif;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

a { color: var(--indigo); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Shell ──────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.side {
    background: var(--indigo-deep);
    position: fixed;
    top: 0; left: 0;
    width: 244px;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    overscroll-behavior: contain;
}

.main { grid-column: 2; min-width: 0; }

.side-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 11px;
}

.side-brand .mk {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 9px;
    background: var(--orange); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 14px;
}

.side-brand .n { color: #fff; font-weight: 700; font-size: 14px; line-height: 1.2; }
.side-brand .s { color: rgba(255,255,255,.5); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; margin-top: 2px; }

.side-nav { padding: 12px 10px 24px; }

.side-title {
    color: rgba(255,255,255,.36);
    font-size: 10px; font-weight: 700; letter-spacing: .16em;
    text-transform: uppercase; padding: 16px 10px 7px;
}

.side a.item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; margin-bottom: 1px;
    border-radius: 8px;
    color: rgba(255,255,255,.75);
    font-size: 13.5px;
    position: relative;
}

.side a.item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.item.on { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.side a.item.on::before {
    content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--orange);
}
.side .pill {
    margin-left: auto; background: var(--orange); color: #fff;
    border-radius: 9px; padding: 1px 7px; font-size: 10.5px; font-weight: 700;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.top {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 26px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; position: sticky; top: 0; z-index: 800;
}

.top h1 { font-size: 20px; }
.top .who { font-size: 13px; color: var(--muted); }

.body-area { padding: 24px 26px 60px; }

.burger {
    display: none; width: 40px; height: 40px;
    border: 1px solid var(--line); border-radius: 9px;
    background: #fff; font-size: 18px; cursor: pointer;
    align-items: center; justify-content: center;
}

.backdrop { display: none; position: fixed; inset: 0; background: rgba(21,12,51,.5); z-index: 900; }
.backdrop.show { display: block; }

/* ── Pieces ─────────────────────────────────────────────────────────────── */

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel { margin-top: 20px; }
.panel-head {
    padding: 15px 18px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.panel-head h2 { font-size: 16px; }
.panel-body { padding: 18px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font-family: 'Archivo', sans-serif; font-size: 25px; font-weight: 800; color: var(--indigo); }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 3px; }

table { width: 100%; border-collapse: collapse; }
.tablewrap { overflow-x: auto; }
.tablewrap table { min-width: 620px; }
th {
    background: #fbfaff; text-align: left; padding: 10px 14px;
    font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
    color: var(--muted); font-weight: 700;
    border-bottom: 2px solid var(--orange);
}
td { padding: 11px 14px; border-bottom: 1px solid #f0eff5; font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbff; }

.chip {
    display: inline-block; padding: 3px 9px; border-radius: 5px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    border: 1px solid transparent;
}
.chip-ok   { background: var(--ok-bg);  color: var(--ok);  border-color: #c6e5d4; }
.chip-bad  { background: var(--bad-bg); color: var(--bad); border-color: #f0cccd; }
.chip-gray { background: #f1f0f6; color: #5f5c6b; border-color: var(--line); }
.chip-org  { background: #fff0e9; color: var(--orange-deep); border-color: #f8d3c2; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
    line-height: 1.2; white-space: nowrap;
}
.btn-primary { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.btn-primary:hover { background: var(--indigo-soft); }
.btn-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-orange:hover { background: var(--orange-deep); }
.btn-line { background: #fff; color: var(--body); border-color: var(--line); }
.btn-line:hover { background: var(--paper); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f0cccd; }
.btn-danger:hover { background: var(--bad-bg); }

.field { margin-bottom: 15px; }
label {
    display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line);
    border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--ink); background: #fff;
}
.input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(30,18,70,.1); }
textarea.input { min-height: 110px; resize: vertical; }
textarea.tall { min-height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--body); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.row { display: grid; gap: 14px; }
.r2 { grid-template-columns: 1fr 1fr; }
.r3 { grid-template-columns: repeat(3, 1fr); }
.editor-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }

.msg { padding: 12px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; border-left-width: 3px; }
.msg-ok  { background: var(--ok-bg);  color: #14603a; border-color: #c6e5d4; border-left-color: var(--ok); }
.msg-bad { background: var(--bad-bg); color: #8e2830; border-color: #f0cccd; border-left-color: var(--bad); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 13px; }
.thumb { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 130px; object-fit: cover; }
.thumb .meta { padding: 9px 11px; font-size: 12px; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ic { font-size: 40px; margin-bottom: 12px; }

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

/* ── Login ──────────────────────────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    /* Column, or the credit line below would sit BESIDE the card. */
    flex-direction: column;
    padding: 20px; background: var(--indigo-deep); position: relative; overflow: hidden;
}
.login-wrap::after {
    content: ""; position: absolute; right: -12%; top: -40%;
    width: 46%; height: 190%; background: var(--orange); transform: rotate(14deg); opacity: .9;
}
.login-card {
    position: relative; z-index: 2; width: 100%; max-width: 400px;
    background: #fff; border-radius: 16px; padding: 34px 30px;
    box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.login-card h1 { font-size: 21px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 6px; margin-bottom: 24px; }
.login-mark {
    width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 14px;
    background: var(--indigo); color: #fff; display: flex; align-items: center; justify-content: center;
    font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 17px;
}

/* The uploaded logo stands in for the initials block. Contained rather than
   cropped, so a wide or tall logo is never cut off. */
.login-logo {
    display: block;
    height: 62px;
    width: auto;
    max-width: 190px;
    margin: 0 auto 16px;
    object-fit: contain;
}

.login-credit {
    position: relative; z-index: 2;
    margin-top: 20px; text-align: center;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
    color: rgba(255,255,255,.6);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .shell { grid-template-columns: 1fr; }
    .main { grid-column: 1; }
    .side { transform: translateX(-100%); transition: transform .24s ease; box-shadow: 2px 0 20px rgba(0,0,0,.25); }
    .side.open { transform: translateX(0); }
    .burger { display: flex; }
    .editor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .body-area { padding: 16px 14px 50px; }
    .top { padding: 12px 14px; }
    .r2, .r3 { grid-template-columns: 1fr; }
    .input { font-size: 16px; }   /* stops iOS zooming on focus */
    .panel-head { flex-direction: column; align-items: flex-start; }
}

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