/* =========================================================================
   Stratus Medicals — CMS admin theme
   ========================================================================= */
:root {
  --blue: #1AA0C8;
  --blue-700: #0f5f79;
  --green: #3FAE57;
  --red: #D42A34;
  --ink: #14303c;
  --body: #46575f;
  --muted: #7b8a91;
  --line: #e3e9ec;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --sidebar: #0b2b3a;
  --radius: 12px;
  --font: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--blue-700); text-decoration: none; }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .5em; line-height: 1.25; }
img { max-width: 100%; display: block; }

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

/* Sidebar */
.sidebar { background: var(--sidebar); color: #a7c4cf; padding: 1.5rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem 1.5rem; }
.sidebar .brand img { height: 34px; }
.sidebar .brand b { color: #fff; font-size: 1.05rem; letter-spacing: -0.01em; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 9px;
  color: #a7c4cf; font-size: .92rem; font-weight: 500; transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.is-active { background: var(--blue); color: #fff; }
.sidebar nav .group-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: #5f8391; padding: 1.2rem .8rem .4rem; }
.sidebar .badge-count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: .7rem; padding: .1rem .45rem; font-weight: 700; }
.sidebar .foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .foot a { font-size: .85rem; }

/* Main */
.main { padding: 1.75rem 2rem 3rem; min-width: 0; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.topline h1 { font-size: 1.5rem; margin: 0; }
.topline .who { font-size: .85rem; color: var(--muted); }

/* Cards / panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.panel + .panel { margin-top: 1.5rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.1rem; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.stat-card b { display: block; font-size: 1.9rem; color: var(--ink); font-weight: 800; letter-spacing: -0.02em; }
.stat-card span { font-size: .82rem; color: var(--muted); }
.stat-card.accent-blue { border-top: 3px solid var(--blue); }
.stat-card.accent-green { border-top: 3px solid var(--green); }
.stat-card.accent-red { border-top: 3px solid var(--red); }

/* Table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #f8fbfc; }
table.data .title-cell a { color: var(--ink); font-weight: 600; }
table.data .title-cell a:hover { color: var(--blue-700); }
table.data .muted { color: var(--muted); font-size: .82rem; }
tr.is-unread td { background: #f0f9fc; }
tr.is-unread .title-cell a { font-weight: 700; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pill--published { background: #e3f5e8; color: #2f8f47; }
.pill--draft { background: #fdeeda; color: #b9791a; }
.pill--news { background: #e7f6fa; color: var(--blue-700); }
.pill--event { background: #eef0f2; color: #55636a; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .45rem; font: inherit; font-weight: 600; font-size: .88rem; padding: .6rem 1.1rem; border-radius: 9px; border: 1.5px solid transparent; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-700); }
.btn--outline { border-color: var(--line); color: var(--ink); background: #fff; }
.btn--outline:hover { border-color: var(--blue); color: var(--blue-700); }
.btn--danger { background: #fff; border-color: #f0c4c7; color: var(--red); }
.btn--danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn--sm { padding: .4rem .7rem; font-size: .8rem; }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--ink); }

.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink); margin-bottom: .4rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.input, .textarea, .select { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: .7rem .85rem; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,160,200,.14); }
.textarea { min-height: 320px; resize: vertical; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; line-height: 1.7; }
.field-error { color: var(--red); font-size: .8rem; margin-top: .3rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.check-row { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.image-preview { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: .6rem; background: var(--bg); }
.image-preview img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

.alert { padding: .85rem 1.1rem; border-radius: 9px; font-size: .9rem; margin-bottom: 1.25rem; }
.alert--success { background: #e3f5e8; color: #2f8f47; border: 1px solid #bfe6c9; }
.alert--error { background: #fdeaeb; color: var(--red); border: 1px solid #f4c9cc; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .7rem 1.1rem; font-size: .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--blue-700); border-bottom-color: var(--blue); }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { width: auto; padding: .5rem .7rem; font-size: .85rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.pagination { display: flex; gap: .3rem; justify-content: center; margin-top: 1.5rem; list-style: none; padding: 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; padding: 0 .5rem; border: 1px solid var(--line); border-radius: 8px; font-size: .85rem; background: #fff; color: var(--body); }
.pagination .active span { background: var(--blue); border-color: var(--blue); color: #fff; }
.pagination .disabled span { opacity: .4; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: linear-gradient(120deg,#0b2b3a,#0f5f79); }
.login-card { background: #fff; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 30px 70px rgba(0,0,0,.25); }
.login-card .brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.login-card .brand img { height: 38px; }
.login-card .brand b { font-size: 1.15rem; color: var(--blue-700); }
.login-card h1 { font-size: 1.3rem; }
.login-card p.sub { color: var(--muted); font-size: .9rem; margin-top: 0; }

@media (max-width: 1000px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-direction: column; }
  .sidebar nav { flex-flow: row wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
