:root {
  --navy: #071b33;
  --navy-2: #0c2b4d;
  --blue: #2f72aa;
  --ice: #eaf2f8;
  --paper: #f5f7fa;
  --white: #fff;
  --ink: #152438;
  --muted: #69788b;
  --line: #dfe5ec;
  --green: #278265;
  --gold: #b8893f;
  --violet: #7358a5;
  --shadow: 0 22px 55px rgba(7, 27, 51, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Segoe UI", Arial, sans-serif; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
.admin-brand { display: flex; align-items: center; gap: 13px; }
.admin-brand > span { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 44px; color: var(--white); background: var(--blue); border-radius: 50%; font-size: .85rem; font-weight: 700; }
.admin-brand strong { display: grid; font-size: .84rem; line-height: 1.2; }
.admin-brand small { margin-top: 4px; opacity: .55; font-size: .57rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.admin-eyebrow { margin: 0 0 14px; color: var(--blue); font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.admin-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 20px; color: var(--white); border: 0; background: var(--blue); border-radius: 10px; font-weight: 650; transition: .25s ease; }
.admin-button:hover { background: #3882bd; transform: translateY(-1px); }

/* Login */
.auth-page { min-height: 100vh; color: var(--white); background: var(--navy); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(480px, .75fr); }
.auth-intro { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; position: relative; padding: 55px clamp(35px, 7vw, 110px); overflow: hidden; background: radial-gradient(circle at 20% 100%, rgba(47,114,170,.35), transparent 36%), var(--navy); }
.auth-intro::after { content: ""; position: absolute; width: 550px; height: 550px; right: -230px; bottom: -230px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.02), 0 0 0 140px rgba(255,255,255,.015); }
.auth-intro .admin-brand, .auth-intro > div, .back-link { position: relative; z-index: 1; }
.auth-intro h1 { max-width: 650px; margin: 0 0 24px; font-size: clamp(2.9rem, 5.6vw, 5.5rem); font-weight: 500; letter-spacing: -.055em; line-height: 1; }
.auth-intro > div > p:last-child { max-width: 580px; color: rgba(255,255,255,.58); font-size: .96rem; }
.back-link { color: rgba(255,255,255,.6); font-size: .76rem; }
.back-link:hover { color: var(--white); }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(35px, 6vw, 90px); color: var(--ink); background: var(--white); }
.auth-card-head { margin-bottom: 30px; }
.lock-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--blue); background: var(--ice); border-radius: 13px; font-size: 1.4rem; }
.auth-card-head p { margin: 22px 0 5px; color: var(--blue); font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.auth-card-head h2 { margin: 0 0 7px; font-size: 1.8rem; letter-spacing: -.03em; }
.auth-card-head > span:last-child { color: var(--muted); font-size: .8rem; }
.auth-card form { display: grid; }
.auth-card form > label { margin: 0 0 7px; font-size: .69rem; font-weight: 650; }
.auth-card input[type="text"], .auth-card input[type="password"] { width: 100%; height: 48px; margin-bottom: 18px; padding: 0 14px; color: var(--ink); border: 1px solid var(--line); outline: 0; background: var(--paper); border-radius: 9px; font-size: .82rem; }
.auth-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,114,170,.1); }
.password-field { position: relative; }
.password-field input { padding-right: 80px !important; }
.password-field button { position: absolute; top: 12px; right: 12px; color: var(--blue); border: 0; background: transparent; font-size: .68rem; font-weight: 600; }
.auth-options { display: flex; justify-content: space-between; align-items: center; margin: -3px 0 20px; color: var(--muted); font-size: .66rem; }
.auth-options label { display: flex; align-items: center; gap: 7px; }
.auth-card .admin-button { width: 100%; }
.auth-status { min-height: 22px; margin: 8px 0 0; color: #b1434e; font-size: .69rem; text-align: center; }
.demo-box { margin-top: 17px; padding: 17px; background: var(--ice); border-radius: 11px; }
.demo-box strong { font-size: .72rem; }
.demo-box p { margin: 3px 0 10px; color: var(--muted); font-size: .65rem; }
.demo-box code { color: var(--navy); }
.demo-box button { padding: 0; color: var(--blue); border: 0; background: transparent; font-size: .7rem; font-weight: 650; }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: .62rem; text-align: center; }

/* Dashboard */
.dashboard-page { min-height: 100vh; }
.admin-sidebar { width: 250px; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; padding: 28px 20px; color: rgba(255,255,255,.68); background: var(--navy); }
.admin-sidebar .admin-brand { padding: 0 8px 27px; color: var(--white); border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-sidebar nav { display: grid; gap: 5px; margin-top: 27px; }
.admin-sidebar nav a { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border-radius: 8px; font-size: .76rem; transition: .2s ease; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { color: var(--white); background: rgba(255,255,255,.09); }
.admin-sidebar nav i { width: 21px; color: #8eb9dc; font-style: normal; text-align: center; }
.sidebar-foot { display: grid; gap: 7px; margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .68rem; }
.sidebar-foot a:hover { color: var(--white); }
.admin-main { min-height: 100vh; margin-left: 250px; padding: 0 38px 25px; }
.admin-header { height: 82px; display: flex; align-items: center; justify-content: space-between; margin: 0 -38px; padding: 0 38px; background: var(--white); border-bottom: 1px solid var(--line); }
.admin-header > div:first-of-type { margin-right: auto; }
.admin-header p { margin: 0; font-size: .88rem; font-weight: 700; }
.admin-header > div:first-of-type > span { color: var(--muted); font-size: .61rem; }
.sidebar-toggle { display: none; margin-right: 15px; border: 0; background: transparent; font-size: 1.2rem; }
.admin-profile { display: flex; align-items: center; gap: 11px; }
.admin-profile > span { width: 38px; height: 38px; display: grid; place-items: center; color: var(--white); background: var(--blue); border-radius: 50%; font-size: .72rem; font-weight: 700; }
.admin-profile div { display: grid; line-height: 1.2; }
.admin-profile strong { font-size: .7rem; }
.admin-profile small { margin-top: 4px; color: var(--muted); font-size: .57rem; }
.demo-banner { display: flex; gap: 14px; margin: 24px 0 0; padding: 11px 16px; color: #77591f; background: #fff8e9; border: 1px solid #efdfb7; border-radius: 9px; font-size: .68rem; }
.demo-banner strong { flex-shrink: 0; }
.dashboard-welcome { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 38px 0 30px; }
.dashboard-welcome h1 { margin: 0 0 5px; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.04em; }
.dashboard-welcome > div > span { color: var(--muted); font-size: .78rem; }
.dashboard-welcome .admin-button { font-size: .72rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-grid article { display: flex; align-items: center; gap: 15px; padding: 21px; background: var(--white); border: 1px solid var(--line); border-radius: 13px; }
.stat-icon { width: 45px; height: 45px; display: grid; place-items: center; flex: 0 0 45px; border-radius: 11px; font-size: 1.15rem; }
.stat-icon.blue { color: var(--blue); background: var(--ice); }
.stat-icon.gold { color: var(--gold); background: #fff4df; }
.stat-icon.green { color: var(--green); background: #e8f5f0; }
.stat-icon.violet { color: var(--violet); background: #f0ebf9; }
.stat-grid article div { display: grid; line-height: 1.2; }
.stat-grid small { color: var(--muted); font-size: .6rem; }
.stat-grid strong { margin: 5px 0; font-size: 1.5rem; }
.stat-grid em { color: var(--green); font-size: .55rem; font-style: normal; }
.admin-panel { margin-bottom: 22px; padding: 24px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-head h2 { margin: 0 0 4px; font-size: 1rem; }
.panel-head p { margin: 0; color: var(--muted); font-size: .66rem; }
.outline-button { padding: 8px 13px; color: var(--blue); border: 1px solid var(--line); background: var(--white); border-radius: 8px; font-size: .66rem; font-weight: 650; }
.text-button, .row-action { padding: 0; color: var(--blue); border: 0; background: transparent; font-size: .65rem; font-weight: 650; }
.admin-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .68rem; }
th { padding: 10px 12px; color: var(--muted); background: var(--paper); font-size: .57rem; text-align: left; text-transform: uppercase; letter-spacing: .07em; }
td { padding: 13px 12px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { display: grid; }
td:first-child small { margin-top: 3px; color: var(--muted); font-size: .56rem; }
.status { display: inline-block; padding: 4px 8px; border-radius: 20px; font-size: .55rem; }
.status.published { color: var(--green); background: #e8f5f0; }
.status.draft { color: var(--gold); background: #fff4df; }
.admin-two-columns { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.activity-list { display: grid; }
.activity-list article { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-top: 1px solid var(--line); }
.activity-list article > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; color: var(--blue); background: var(--ice); border-radius: 9px; font-size: .58rem; font-weight: 700; }
.activity-list article div { display: grid; }
.activity-list strong { font-size: .7rem; }
.activity-list small { margin-top: 3px; color: var(--muted); font-size: .56rem; }
.roadmap-list { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.roadmap-list li { display: flex; align-items: center; gap: 12px; }
.roadmap-list li > span { width: 29px; height: 29px; display: grid; place-items: center; flex: 0 0 29px; color: var(--muted); background: var(--paper); border-radius: 50%; font-size: .6rem; }
.roadmap-list li.done > span { color: var(--white); background: var(--green); }
.roadmap-list li div { display: grid; }
.roadmap-list strong { font-size: .68rem; }
.roadmap-list small { color: var(--muted); font-size: .56rem; }
.admin-footer { display: flex; justify-content: space-between; color: var(--muted); font-size: .6rem; }
.admin-footer a { color: var(--blue); }
.admin-toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 12px 17px; color: var(--white); background: var(--navy); border-radius: 9px; box-shadow: var(--shadow); font-size: .69rem; opacity: 0; visibility: hidden; transform: translateY(10px); transition: .25s ease; }
.admin-toast.visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* Badges & misc */
.nav-badge { margin-left: auto; padding: 1px 7px; color: var(--white); background: #b1434e; border-radius: 20px; font-size: .58rem; font-weight: 700; }
.admin-sidebar nav a { justify-content: flex-start; }
.status.unread { color: #b1434e; background: #fbe9ea; }
.status.read { color: var(--muted); background: var(--paper); }
.row-actions { display: flex; gap: 10px; white-space: nowrap; }
.row-action.danger { color: #b1434e; }
.table-empty { padding: 22px 0; color: var(--muted); text-align: center; }
.table-error { padding: 22px 0; color: #b1434e; text-align: center; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; }
.pager button { padding: 7px 14px; color: var(--ink); border: 1px solid var(--line); background: var(--white); border-radius: 8px; font-size: .68rem; font-weight: 650; cursor: pointer; }
.pager button:disabled { color: var(--muted); cursor: not-allowed; opacity: .5; }
.pager span { color: var(--muted); font-size: .66rem; }
.link-cell { display: inline-block; max-width: 220px; overflow: hidden; color: var(--blue); text-overflow: ellipsis; white-space: nowrap; }

/* Forms (settings, password, CRUD modal) */
.admin-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field label { font-size: .68rem; font-weight: 650; }
.field small.hint { color: var(--muted); font-size: .6rem; font-weight: 500; }
.field input[type="text"], .field input[type="email"], .field input[type="url"],
.field input[type="password"], .field input[type="number"], .field input[type="date"],
.field select, .field textarea, .field input[type="file"] {
  width: 100%; padding: 10px 13px; color: var(--ink); border: 1px solid var(--line);
  outline: 0; background: var(--paper); border-radius: 9px; font-size: .8rem; font-family: inherit;
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,114,170,.1); }
.field-checkbox { display: flex; align-items: center; gap: 9px; font-size: .74rem; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 4px; }
.current-file-note { color: var(--muted); font-size: .62rem; }

.upload-progress { display: grid; gap: 7px; margin-top: 4px; padding: 11px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }
.upload-progress[hidden] { display: none; }
.upload-progress-head { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .62rem; }
.upload-progress-head strong { color: var(--ink); }
.upload-progress progress { width: 100%; height: 8px; accent-color: var(--blue); }
.admin-form.is-submitting input, .admin-form.is-submitting select, .admin-form.is-submitting textarea { opacity: .72; }


/* Modal (CRUD & message detail) */
.admin-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; }
.admin-modal[hidden] { display: none !important; }
.admin-modal .modal-backdrop { position: fixed; inset: 0; background: rgba(7,27,51,.55); }
.entity-modal-panel { width: min(100%, 640px); position: relative; z-index: 1; max-height: 88vh; overflow-y: auto; padding: 30px; background: var(--white); border-radius: 16px; box-shadow: var(--shadow); }
.entity-modal-panel h3 { margin: 0 0 18px; font-size: 1.15rem; }
.entity-modal-panel .modal-close { position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; color: var(--muted); border: 0; background: var(--paper); border-radius: 50%; font-size: .8rem; }
.message-detail { display: grid; gap: 10px; font-size: .8rem; }
.message-detail dt { color: var(--muted); font-size: .6rem; text-transform: uppercase; letter-spacing: .08em; }
.message-detail dd { margin: 2px 0 10px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-two-columns { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 390px; padding: 35px 28px; }
  .auth-intro .back-link { display: none; }
  .auth-intro h1 { font-size: 3.1rem; }
  .auth-card { padding: 45px 28px; }
  .admin-sidebar { transform: translateX(-100%); transition: .25s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; padding: 0 20px 20px; }
  .admin-header { margin: 0 -20px; padding: 0 20px; }
  .sidebar-toggle { display: block; }
}
@media (max-width: 540px) {
  .auth-intro { min-height: 340px; }
  .auth-intro h1 { font-size: 2.45rem; }
  .admin-profile div { display: none; }
  .dashboard-welcome { align-items: stretch; flex-direction: column; }
  .stat-grid { grid-template-columns: 1fr; }
  .demo-banner { flex-direction: column; gap: 3px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .admin-footer { gap: 10px; flex-direction: column; }
}
