/* The Horse Co — Operations. Palette and type follow the storefront theme. */
:root {
  --olive: #4c5b45;
  --olive-dark: #3d4a37;
  --sage: #6b8063;
  --sand: #ede5d3;
  --sand-deep: #ded6c2;
  --paper: #f9f8f6;
  --ink: #1f2a1c;
  --muted: #6b7266;
  --line: #e4e0d6;
  --white: #fff;
  --success: #2f7a4a;
  --success-bg: #e5f2e8;
  --warning: #9a6a00;
  --warning-bg: #fbf1d9;
  --error: #b42318;
  --error-bg: #fbe7e5;
  --info: #285d8f;
  --info-bg: #e5eef7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 28, 0.06), 0 4px 16px rgba(31, 42, 28, 0.05);
  --font-head: 'Bebas Neue', Impact, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font-body); color: var(--ink); background: var(--paper); }
a { color: var(--olive); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; letter-spacing: 0.04em; color: var(--olive); margin: 0 0 0.4em; line-height: 1.1; }
h1 { font-size: 34px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
code { background: var(--sand); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--olive); color: var(--sand); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand img { width: 150px; display: block; margin: 0 8px 4px; }
.sidebar .brand span { display: block; font-family: var(--font-head); letter-spacing: 0.2em; font-size: 13px; color: var(--sand-deep); margin: 0 10px 26px; opacity: 0.85; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--sand); text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav a.active { background: var(--sand); color: var(--olive); }
.nav .section { font-family: var(--font-head); letter-spacing: 0.16em; font-size: 12px; color: var(--sand-deep); opacity: 0.7; margin: 18px 12px 6px; }
.nav .soon { opacity: 0.55; cursor: default; }
.nav .soon:hover { background: none; }
.nav .soon em { font-style: normal; font-size: 10px; border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; margin-left: auto; }
.sidebar .me { margin-top: auto; font-size: 12px; padding: 12px; border-top: 1px solid rgba(237, 229, 211, 0.2); }
.sidebar .me a { color: var(--sand); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--white); position: sticky; top: 0; z-index: 5; }
.topbar .clock { margin-right: auto; color: var(--muted); font-size: 12px; }
.content { padding: 28px 32px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ---------- components */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
.stat .n { font-family: var(--font-head); font-size: 38px; color: var(--olive); line-height: 1; }
.stat .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; }
.stat.error .n { color: var(--error); }
.stat.warning .n { color: var(--warning); }
a.stat:hover { border-color: var(--sage); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--olive); background: var(--olive); color: var(--white); padding: 9px 16px; border-radius: 8px; font: 600 13px var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sage); border-color: var(--sage); }
.btn.secondary { background: var(--white); color: var(--olive); }
.btn.secondary:hover { background: var(--sand); }
.btn.danger { background: var(--white); color: var(--error); border-color: #e3b6b1; }
.btn.danger:hover { background: var(--error-bg); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; background: var(--sand); color: var(--olive); white-space: nowrap; }
.badge.success, .badge.ok, .badge.applied, .badge.reverted { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.error, .badge.failed, .badge.conflict { background: var(--error-bg); color: var(--error); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted, .badge.skip, .badge.skipped { background: #eeeeea; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid; }
.alert.success { background: var(--success-bg); color: var(--success); border-color: #b9dcc3; }
.alert.error { background: var(--error-bg); color: var(--error); border-color: #efc0bb; }
.alert.warning { background: var(--warning-bg); color: var(--warning); border-color: #ecd59c; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #bcd2e8; }

/* ---------- forms */
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=number], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: 14px var(--font-body); background: var(--white); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sage); outline-offset: -1px; border-color: var(--sage); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-cards label { border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; font-weight: 500; display: flex; gap: 8px; }
.radio-cards label:has(input:checked) { border-color: var(--olive); background: #f3f1ea; }
.dropzone { border: 2px dashed var(--sand-deep); border-radius: var(--radius); padding: 28px; text-align: center; background: #fbfaf6; }
.dropzone.drag { border-color: var(--olive); background: var(--sand); }

/* ---------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: #f6f4ee; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.excluded td { opacity: 0.45; }
td .strike { text-decoration: line-through; color: var(--muted); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.msg { color: var(--muted); font-size: 12px; max-width: 360px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 99px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: 13px; }
.tabs a.active { background: var(--olive); color: var(--white); }
.tabs a .c { opacity: 0.75; margin-left: 4px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* ---------- progress */
.progress { height: 8px; background: var(--sand); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--olive); width: 0; transition: width 0.4s; }
.progress.indeterminate > div { width: 35%; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ---------- notifications bell */
.bell { position: relative; }
.bell > button { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--olive); display: flex; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--error); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.bell .panel { position: absolute; right: 0; top: 44px; width: 360px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14); display: none; }
.bell.open .panel { display: block; }
.bell .panel header { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; border-left: 3px solid transparent; }
.notif.unread { background: #faf8f2; }
.notif.error { border-left-color: var(--error); }
.notif.warning { border-left-color: var(--warning); }
.notif.success { border-left-color: var(--success); }
.notif strong { display: block; font-size: 13px; }
.notif span { font-size: 12px; color: var(--muted); }
.toast { position: fixed; bottom: 22px; right: 22px; max-width: 380px; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); z-index: 50; }
.toast.error { background: var(--error); }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--olive); padding: 24px; }
.login .box { background: var(--paper); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 420px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.login img { width: 220px; margin-bottom: 18px; }
.login h1 { font-size: 28px; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.module { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; }
.module.soon { opacity: 0.6; }
.module h3 { margin-bottom: 6px; }
a.module:hover { border-color: var(--sage); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2, .radio-cards { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
