:root {
  --orange: #EC6B22; --orange-dark: #d05a15; --navy: #193153; --navy-deep: #10213a;
  --ink: #1f2937; --muted: #5b6577; --line: #e5e9f0; --tint: #f3f5f8; --white: #fff;
  --green: #1e8e5a; --red: #c0392b; --amber: #b7791f;
  --radius: 12px; --shadow: 0 2px 10px rgba(16,33,58,.08);
  --head: "Poppins", system-ui, sans-serif; --body: "Roboto", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--tint); }
h1, h2, h3 { font-family: var(--head); color: var(--navy); line-height: 1.25; margin: 0 0 .6em; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--orange); }
img { max-width: 100%; height: auto; display: block; }
table { border-collapse: collapse; width: 100%; }
.muted { color: var(--muted); }
small { font-size: .85em; }

/* Layout */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy-deep); color: #fff; padding: 22px 18px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.side__brand img { height: 44px; }
.side__nav { display: flex; flex-direction: column; gap: 4px; }
.side__nav a { color: rgba(255,255,255,.8); padding: 10px 12px; border-radius: 8px; font-weight: 500; }
.side__nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side__nav a.is-active { background: var(--orange); color: #fff; }
.side__user { margin-top: auto; font-size: .9rem; display: flex; flex-direction: column; gap: 2px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.side__user span { color: rgba(255,255,255,.6); }
.side__user a { color: #ffb98c; margin-top: 6px; }
.side-toggle { display: none; }
.main { padding: 28px 36px 60px; min-width: 0; }
.main__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.main__head h1 { font-size: 1.7rem; margin: 0; }

/* Components */
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--head); font-weight: 600; font-size: .9rem; padding: 10px 20px; border-radius: 999px; border: 2px solid transparent; cursor: pointer; transition: .2s; white-space: nowrap; background: #fff; color: var(--navy); }
.btn--primary { background: var(--orange); color: #fff; }
.btn--primary:hover { background: var(--orange-dark); color: #fff; }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover { background: #24446f; color: #fff; }
.btn--outline { border-color: var(--line); }
.btn--outline:hover { border-color: var(--navy); }
.btn--danger { background: #fdecea; color: var(--red); }
.btn--danger:hover { background: var(--red); color: #fff; }
.btn--sm { padding: 6px 14px; font-size: .8rem; }
.btn--green { background: var(--green); color: #fff; }
.btn--green:hover { background: #166e45; color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.toolbar form { display: flex; gap: 8px; align-items: center; }
.toolbar .spacer { flex: 1; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 22px; }
.stat--alert { border-color: var(--orange); }
.stat--alert strong { color: var(--orange); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat strong { font-family: var(--head); font-size: 2rem; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.table tr:hover td { background: #fafbfd; }
.table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.badge--published { background: #e3f6ec; color: var(--green); }
.badge--draft { background: #eef0f4; color: var(--muted); }
.badge--expired { background: #fff4e5; color: var(--amber); }
.badge--trash { background: #fdecea; color: var(--red); }
.badge--admin { background: #e8edf7; color: var(--navy); }
.badge--editor { background: #eef0f4; color: var(--muted); }
.badge--inactive { background: #fdecea; color: var(--red); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash--success { background: #e3f6ec; color: var(--green); }
.flash--error { background: #fdecea; color: var(--red); }
.flash--info { background: #e8edf7; color: var(--navy); }
.toplist { margin: 0; padding-left: 22px; }
.toplist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.toplist span { color: var(--muted); white-space: nowrap; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .9rem; font-weight: 500; }
.tabs a.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Forms */
.form label, .form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-weight: 500; color: var(--navy); }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=date], .form input[type=number], .form select, .form textarea {
  font: inherit; font-size: .95rem; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); outline: none; width: 100%; font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(236,107,34,.15); }
.form textarea { min-height: 180px; resize: vertical; font-family: var(--body); }
.form textarea.short { min-height: 90px; }
.form .hint { font-weight: 400; font-size: .83rem; color: var(--muted); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form .row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form .check { flex-direction: row; align-items: center; gap: 10px; }
.form .check input { width: auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 10px; }
.form-actions .spacer { flex: 1; }
.inline-form { display: inline; }
.job-side { display: flex; flex-direction: column; gap: 16px; }
.job-side .panel { margin: 0; }
.job-side dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.job-side dt { color: var(--muted); }
.job-side dd { margin: 0; font-weight: 500; }
.history { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history time { color: var(--muted); display: block; font-size: .8rem; }
.edit-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }

/* Content editor */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.media-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.media-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--tint); }
.media-item .meta { padding: 10px 12px; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.media-item .meta strong { color: var(--ink); word-break: break-all; font-weight: 500; }
.media-item .meta .actions { display: flex; gap: 6px; margin-top: 6px; }
.upload-box { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--navy-deep), var(--navy)); padding: 20px; }
.login__box { background: #fff; width: min(100%, 400px); padding: 36px 32px; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 14px; }
.login__logo { height: 54px; width: auto; background: var(--navy); padding: 8px 14px; border-radius: 10px; align-self: flex-start; }
.login__box h1 { font-size: 1.4rem; margin: 6px 0 4px; }
.login__box label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; color: var(--navy); }
.login__box input { font: inherit; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); outline: none; }
.login__box input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(236,107,34,.15); }
.login__box .btn { justify-content: center; margin-top: 6px; }
.login__back { font-size: .88rem; color: var(--muted); text-align: center; }

@media (max-width: 960px) {
  .admin { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: .25s; z-index: 50; }
  .side.is-open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .side-toggle { display: block; position: fixed; top: 12px; right: 12px; z-index: 60; width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--navy); color: #fff; font-size: 1.2rem; cursor: pointer; }
  .main { padding: 20px 16px 60px; }
  .main__head { padding-right: 56px; }
  .grid-2, .edit-grid, .stats { grid-template-columns: 1fr; }
  .form .row, .form .row-3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}
@media (max-width: 600px) { .stats { grid-template-columns: 1fr 1fr; } .stats > :nth-child(5) { grid-column: 1 / -1; } }

/* Formatting editor */
.editor { border: 1.5px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(236,107,34,.15); }
.editor__bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; background: var(--tint); border-bottom: 1px solid var(--line); }
.editor__bar button { font: inherit; font-size: .85rem; min-width: 32px; padding: 5px 9px; border-radius: 6px; border: 1px solid transparent; background: #fff; color: var(--navy); cursor: pointer; }
.editor__bar button:hover { border-color: var(--line); }
.editor__bar button.is-on { background: var(--navy); color: #fff; }
.editor__sep { width: 1px; background: var(--line); margin: 2px 4px; }
.editor__area { min-height: 220px; padding: 12px 16px; outline: none; font-weight: 400; line-height: 1.6; }
.editor--short .editor__area { min-height: 110px; }
.editor__area p { margin: 0 0 .7em; }
.editor__area h3 { font-size: 1.1rem; margin: .8em 0 .4em; color: var(--navy); }
.editor__area h4 { font-size: 1rem; margin: .8em 0 .4em; color: var(--navy); }
.editor__area ul, .editor__area ol { padding-left: 24px; margin: 0 0 .7em; }
.editor__area ul { list-style: disc; }
.editor__area ol { list-style: decimal; }
.editor__area a { color: var(--orange); text-decoration: underline; }

/* Form polish */
.main__back { font-size: .85rem; color: var(--muted); display: inline-block; margin-bottom: 4px; }
.main__back:hover { color: var(--orange); }
.main__sub { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.form-section { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 6px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.form-section:not(:first-of-type) { margin-top: 10px; }
.label-text { display: inline-flex; align-items: baseline; gap: 6px; }
.req { font-style: normal; color: var(--red); font-weight: 600; }
.opt { font-style: normal; font-weight: 400; font-size: .8rem; color: var(--muted); background: var(--tint); padding: 1px 8px; border-radius: 999px; }
.form-actions--sticky { position: sticky; bottom: 0; background: #fff; padding-bottom: 6px; margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; box-shadow: 0 -8px 16px -12px rgba(16,33,58,.25); z-index: 2; }
.form input::placeholder { color: #9aa3b2; }
.editor__bar button { font-weight: 500; }
.editor__bar button b, .editor__bar button i, .editor__bar button u { font-size: .95rem; }
@media (max-width: 960px) {
  .form-actions--sticky { position: static; margin: 0; padding: 12px 0 0; box-shadow: none; }
}

/* Users */
.pills { display: flex; gap: 8px; }
.pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .88rem; color: var(--muted); }
.pill strong { color: var(--navy); margin-right: 3px; }
.reveal-panel { border-color: var(--orange); animation: panelIn .2s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel__head h2 { margin: 0; }
.panel--table { padding: 6px 10px; overflow-x: auto; }
.table--users th, .table--users td { vertical-align: middle; padding: 12px 14px; }
.table--users .th-actions { text-align: right; }
.user { display: flex; align-items: center; gap: 12px; }
.user__text { display: flex; flex-direction: column; line-height: 1.3; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-weight: 600; font-size: .85rem; color: #fff; background: var(--navy); }
.avatar--admin { background: var(--orange); }
.is-inactive td { opacity: .6; }
.actions--right { justify-content: flex-end; }
.row-extra td { background: #fffaf5; border-top: 0; padding-top: 6px; padding-bottom: 14px; }
.form--inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form--inline label { margin: 0; flex: 1 1 260px; }
.form--inline .btn { margin-bottom: 2px; }
@media (max-width: 960px) { .actions--right { justify-content: flex-start; } }
.table--users td:nth-child(5) { white-space: nowrap; }
.table--users .actions { min-width: 250px; }

/* Site content page */
.content-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
.content-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.content-nav__search { font: inherit; font-size: .9rem; padding: 9px 12px; border-radius: 8px; border: 1.5px solid var(--line); outline: none; margin-bottom: 6px; }
.content-nav__search:focus { border-color: var(--orange); }
.content-nav__item { text-align: left; font: inherit; background: none; border: 0; border-radius: 8px; padding: 9px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: var(--navy); font-weight: 500; }
.content-nav__item small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.content-nav__item small b { color: var(--orange); font-weight: 600; }
.content-nav__item:hover { background: var(--tint); }
.content-nav__item.is-active { background: var(--navy); color: #fff; }
.content-nav__item.is-active small, .content-nav__item.is-active small b { color: rgba(255,255,255,.75); }
.content-group { margin-bottom: 16px; }
.cfield { display: flex; flex-direction: column; gap: 6px; padding: 16px 0; border-bottom: 1px solid var(--line); margin: 0; }
.cfield:last-child { border-bottom: 0; }
.cfield__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; color: var(--navy); }
.cfield__tools { display: flex; gap: 8px; align-items: center; }
.link-btn { font: inherit; font-size: .8rem; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }
.link-btn:hover { color: var(--orange); }
.img-slot { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.img-slot img { border-radius: 8px; border: 1px solid var(--line); background: var(--tint); aspect-ratio: 16/10; object-fit: cover; width: 180px; }
.img-slot__meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.img-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; background: #fffaf5; border: 1px dashed #f3c7a8; border-radius: 10px; animation: panelIn .2s ease; }
.img-controls label { margin: 0; }
.img-controls select, .img-controls input[type=file] { font-size: .88rem; }
.content-empty { padding: 20px; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; margin-top: 16px; box-shadow: 0 -8px 24px -12px rgba(16,33,58,.3); z-index: 5; }
.savebar__status { font-size: .9rem; color: var(--muted); }
.savebar__status.is-dirty { color: var(--orange); font-weight: 600; }
.savebar__status.is-dirty::before { content: "●"; margin-right: 6px; }
@media (max-width: 960px) {
  .content-layout { grid-template-columns: 1fr; }
  .content-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .content-nav__search { width: 100%; }
  .content-nav__item small { display: none; }
  .img-slot { grid-template-columns: 1fr; }
  .img-slot img { width: 100%; max-width: 320px; }
  .img-controls { grid-template-columns: 1fr; }
}
[hidden] { display: none !important; }
.savebar .spacer, .form-actions .spacer { flex: 1; }
@media (max-width: 600px) {
  .savebar { flex-wrap: wrap; padding: 10px 14px; }
  .savebar__status { width: 100%; font-size: .85rem; }
  .savebar .btn { flex: 1; justify-content: center; }
}

/* Applications */
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.toolbar__filters { flex-wrap: wrap; }
.toolbar__filters select, .toolbar__filters input[type=search] { font: inherit; font-size: .9rem; padding: 8px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; min-width: 220px; }
.table--apps td { vertical-align: middle; }
.table--apps tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.doc { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: #e8edf7; color: var(--navy); margin-right: 4px; }
.doc:hover { background: var(--navy); color: #fff; }
.doc--text { background: var(--tint); color: var(--muted); }
.doc--big { font-size: .8rem; padding: 10px 12px; border-radius: 8px; min-width: 48px; text-align: center; }
.badge--app-new { background: #fff4e5; color: var(--amber); }
.badge--app-reviewed { background: #e8edf7; color: var(--navy); }
.badge--app-shortlisted { background: #e3f6ec; color: var(--green); }
.badge--app-rejected { background: #eef0f4; color: var(--muted); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.docs li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.docs li > span:nth-child(2) { flex: 1; }
.h-sub { font-size: 1rem; margin: 18px 0 8px; }
.letter { background: var(--tint); border-radius: 10px; padding: 16px 18px; white-space: normal; line-height: 1.7; }
.storage { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.storage h2 { margin-bottom: 6px; } .storage p { margin: 0; max-width: 760px; }
code { background: var(--tint); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
@media (max-width: 960px) { .stats--3 { grid-template-columns: 1fr; } .storage { flex-direction: column; align-items: flex-start; } .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dt { margin-top: 8px; } }
.toolbar__filters select, .toolbar__filters input[type=search] { width: auto; }
.toolbar__filters select { max-width: 360px; }

/* Comfortable tap targets on small screens */
@media (max-width: 960px) {
  .side__user a, .main__back, .link-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 6px; }
  .btn--sm { min-height: 36px; }
}
