:root {
  --bg: #f3eee5;
  --panel: #fffdf8;
  --ink: #1b1712;
  --muted: #7c7265;
  --line: #e4dac9;
  --accent: #d21f2b;
  --accent-dark: #a91620;
  --dark: #14110d;
  --dark-2: #1d1914;
  --gold: #b08d57;
  --ok: #2f7d4f;
  --warn: #b5791a;
  --err: #b3261e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(38, 28, 16, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
h1, h2, h3, .serif {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { padding: 60px; color: var(--muted); }

/* ---------- Login ---------- */
.login-body {
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(210, 31, 43, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(176, 141, 87, 0.16), transparent 55%),
    #14110d;
  color: #f5efe4;
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-card {
  width: 100%;
  max-width: 420px;
  background: #1c1813;
  border: 1px solid #332b21;
  border-radius: 20px;
  padding: 38px 34px 30px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-card h1 { margin: 16px 0 6px; font-size: 30px; color: #f7f0e4; }
.login-card .muted { color: #a99c88; margin: 0 0 24px; }
.login-card label { display: block; margin-bottom: 14px; color: #cdbfa9; font-size: 13px; }
.login-card input {
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #3a3126;
  background: #14110d;
  color: #f5efe4;
  outline: none;
}
.login-card input:focus { border-color: var(--gold); }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-note { margin: 18px 0 0; font-size: 12px; color: #8f8371; text-align: center; }
.form-error { color: #ff8b8b; font-size: 13px; min-height: 18px; padding-top: 8px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #8e1119);
  color: #fff; font-weight: 800; letter-spacing: 0.5px;
  font-family: Georgia, serif;
}
.brand-mark.small { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #17130f, #100d0a);
  color: #e9dfcf;
  padding: 24px 18px;
  display: flex; flex-direction: column;
  border-right: 1px solid #2a231b;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 600; letter-spacing: 0.2px;
  margin-bottom: 30px; font-size: 15px;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  text-decoration: none; padding: 10px 12px; border-radius: 9px;
  color: #bcae99; font-size: 14px;
}
.side-nav a:hover { background: #221d17; color: #f2e8d8; }
.side-nav a.active { background: #2a231b; color: #fff6e6; }
.side-foot { margin-top: auto; border-top: 1px solid #2a231b; padding-top: 16px; }
.user-email { font-size: 12px; color: #92866f; margin-bottom: 8px; word-break: break-all; }
.link {
  background: none; border: none; padding: 0; color: #cdbfa9;
  cursor: pointer; text-decoration: underline; font-size: 13px;
}
.link:hover { color: #fff; }

.main { padding: 34px 38px 60px; min-width: 0; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 24px;
}
.page-head h1 { margin: 0; font-size: 32px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  text-decoration: none; font-size: 14px; font-weight: 550;
  transition: 0.15s ease;
}
.btn:hover { border-color: #cbbcA6; transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff; border-color: transparent;
  box-shadow: 0 8px 20px rgba(210, 31, 43, 0.22);
}
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--err); }

/* ---------- Cards / layout ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card.pad { padding: 22px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.project-card {
  overflow: hidden; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; transition: 0.18s ease;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(38, 28, 16, 0.13); }
.project-cover {
  aspect-ratio: 4 / 3; background: #e9e1d4 center/cover no-repeat;
  display: grid; place-items: center; color: #b3a58f; font-size: 12px;
}
.project-body { padding: 14px 16px 16px; }
.project-title { font-weight: 600; margin-bottom: 6px; }
.project-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px; font-size: 12px;
  background: #efe7d9; color: #6f6454;
}
.badge.ok { background: #e5f2e9; color: var(--ok); }
.badge.warn { background: #fbf0d8; color: var(--warn); }
.badge.err { background: #fbe6e4; color: var(--err); }
.badge.run { background: #fde8e9; color: var(--accent); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
label.field > span { display: block; margin-bottom: 6px; font-weight: 550; color: #5c5347; }
input[type="text"], input[type="url"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }
input[type="color"] { width: 52px; height: 36px; padding: 3px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.style-option { position: relative; }
.style-option input { position: absolute; opacity: 0; pointer-events: none; }
.style-option label {
  display: block; padding: 12px 13px; border: 1px solid var(--line);
  border-radius: 11px; cursor: pointer; background: #fff; height: 100%;
  transition: 0.15s;
}
.style-option label:hover { border-color: #cdbfa6; }
.style-option input:checked + label { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(210, 31, 43, 0.12); background: #fffaf6; }
.style-option .cat { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.style-option .name { font-weight: 600; font-size: 13.5px; }

.upload-box {
  border: 1.5px dashed #cdbfa6; border-radius: 12px; padding: 18px;
  background: #fbf7ef; text-align: center; cursor: pointer;
}
.upload-box:hover { border-color: var(--gold); }
.upload-box input { display: none; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb { width: 72px; height: 72px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: #eee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Passport ---------- */
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.fact { background: #f4ede1; border: 1px solid #e8ddca; border-radius: 8px; padding: 6px 9px; font-size: 12.5px; }
.slide-edit { border-top: 1px solid var(--line); padding: 12px 0; }
.slide-edit:first-of-type { border-top: none; }
.slide-edit .idx { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.slide-edit input { margin-top: 5px; }
.slide-edit .sub { margin-top: 6px; }

/* ---------- Generation ---------- */
.notice { background: #fbf3e3; border: 1px solid #eddfc2; border-radius: 10px; padding: 11px 13px; font-size: 13px; color: #725d38; }
.progress { height: 8px; background: #eee5d7; border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #e8684a); transition: width 0.4s; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.shot { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.shot .imgbox { aspect-ratio: 3 / 4; background: #f0e9dc; display: grid; place-items: center; color: #b0a28b; font-size: 12px; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .cap { padding: 9px 11px; font-size: 12.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shot .cap b { font-weight: 600; }
.shot .err { padding: 9px 11px; font-size: 11.5px; color: var(--err); border-top: 1px solid #f3dcda; }

.empty { padding: 54px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); margin: 0 0 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 20px; bottom: 20px; max-width: 380px;
  background: #1d1914; color: #f6eee2; padding: 12px 16px; border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); font-size: 13px;
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: 0.2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #6f1a1a; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; padding: 12px 16px; gap: 14px; }
  .side-brand { margin: 0; }
  .side-nav { flex-direction: row; }
  .side-foot { margin: 0 0 0 auto; border: none; padding: 0; display: flex; align-items: center; gap: 10px; }
  .user-email { margin: 0; }
  .main { padding: 22px 16px 50px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
