:root {
  --ink: #14241e;
  --ink-2: #1c332b;
  --paper: #f3eee6;
  --card: #fffdf8;
  --line: #e4d8c8;
  --copper: #b4532a;
  --copper-deep: #8c3e1c;
  --sage: #3e6b5a;
  --text: #1c241f;
  --muted: #6f675c;
  --shadow: 0 12px 32px rgba(28, 36, 31, 0.06);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(196, 98, 45, 0.08), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(62, 107, 90, 0.1), transparent 50%),
    var(--paper);
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
::selection { background: #f0c7a4; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

h1, h2, .brand strong {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #183028 0%, #101c18 100%);
  color: #f6f1e8;
}
.sidebar-inner { display: flex; flex-direction: column; min-height: 100%; padding: 22px 16px 18px; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.brand strong { display: block; font-size: 17px; color: #fffaf3; line-height: 1.1; }
.brand small { display: block; margin-top: 3px; color: rgba(246, 241, 232, 0.62); font-family: var(--sans); font-size: 12px; letter-spacing: 0; font-weight: 500; }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px;
  color: rgba(246, 241, 232, 0.78); text-decoration: none; font-weight: 550;
}
.side-link svg { flex: 0 0 auto; }
.side-link span { flex: 1; }
.side-link:hover { background: rgba(246, 241, 232, 0.06); color: #fffaf3; }
.side-link.is-active { background: rgba(246, 241, 232, 0.12); color: #fffaf3; }
.side-link.is-active svg { color: #f0c2a4; }
.nav-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--copper); color: white; font-style: normal; font-size: 12px;
  display: grid; place-items: center;
}
.user-card {
  margin-top: auto; padding: 14px; border-radius: 18px;
  background: rgba(246, 241, 232, 0.08);
}
.user-card strong { display: block; font-family: var(--sans); letter-spacing: 0; font-size: 15px; }
.user-card span { display: block; margin: 4px 0 10px; color: rgba(246, 241, 232, 0.66); font-size: 13px; }
.user-card button {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; color: #f0c2a4;
  font-weight: 650; cursor: pointer;
}
.backdrop { display: none; }
.topbar { display: none; }
.main { min-width: 0; }
.content { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 36px 0 64px; }

.page-head h1 { margin: 0 0 6px; font-size: 36px; line-height: 1.05; }
.page-head p, .lede { margin: 0; color: var(--muted); line-height: 1.5; }
.section-label { margin: 28px 0 14px; font-family: var(--sans); font-size: 15px; font-weight: 700; letter-spacing: 0; }
.section-row { align-items: baseline; }
.section-gap { margin-top: 18px; }
.text-link { color: var(--copper-deep); font-weight: 650; text-decoration: none; }
.row-between, .row-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-actions { justify-content: flex-start; }

.search { position: relative; margin-top: 22px; }
.search input {
  width: 100%; height: 54px; border-radius: 999px; border: 1px solid var(--line);
  background: white; padding: 0 18px 0 48px; box-shadow: var(--shadow); color: var(--text);
}
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #8a8175; display: grid; }

.grid-cats, .grid-materials, .stats, .form-grid { display: grid; gap: 16px; }
.grid-cats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-materials { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; }
.form-grid { grid-template-columns: 1fr 1fr; margin-top: 8px; }

.cat-card, .material-card, .stat, .form-card, .note, .table-wrap, .empty {
  background: var(--card);
  border: 1px solid rgba(28, 36, 31, 0.06);
  box-shadow: var(--shadow);
}
.cat-card {
  display: flex; align-items: center; gap: 14px;
  min-height: 96px; padding: 16px 18px; border-radius: 22px; text-decoration: none;
}
.cat-card strong { display: block; font-size: 15px; }
.cat-card small, .cell-sub, .hint, .note small { display: block; color: var(--muted); font-size: 13px; }
.cat-card:hover, .material-card:hover { transform: translateY(-2px); }
.cat-icon {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink);
}
.cat-icon-lg { width: 64px; height: 64px; border-radius: 20px; background: rgba(255, 255, 255, 0.45); }
.inline-icon { width: 28px; height: 28px; border-radius: 9px; display: inline-grid; place-items: center; margin-right: 8px; vertical-align: middle; }

.material-card { display: flex; flex-direction: column; border-radius: 24px; overflow: hidden; text-decoration: none; min-height: 100%; transition: transform .18s ease; }
.material-cover { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; }
.material-cover img, .detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-icon { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: rgba(255, 253, 248, 0.55); color: var(--ink); }
.badge {
  position: absolute; top: 12px; right: 12px; background: #e7b34a; color: #3d2a08;
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 8px;
}
.material-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kicker { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sage); font-weight: 700; }
.material-card h3 { margin: 0 0 8px; font-family: var(--sans); font-weight: 650; font-size: 16px; letter-spacing: -0.02em; line-height: 1.35; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 18px; border: 0; text-decoration: none;
  font-weight: 650; cursor: pointer;
}
.btn-primary { background: var(--copper); color: white; }
.btn-primary:hover { background: var(--copper-deep); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-soft { display: block; width: 100%; margin-top: auto; background: #f4eee6; color: #3d342c; padding: 10px 14px; }
.material-card:hover .btn-soft { background: var(--ink); color: #fffaf3; }

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14px; }
.back:hover { color: var(--text); }
.cat-hero { display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: 28px; margin-top: 14px; }
.cat-hero h1 { margin: 0; font-size: 32px; }
.cat-hero p { margin: 4px 0 0; color: rgba(28, 36, 31, 0.72); }
.detail { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: center; margin: 18px 0 12px; }
.detail-cover { aspect-ratio: 1; border-radius: 28px; overflow: hidden; display: grid; place-items: center; }
.detail h1 { margin: 6px 0 8px; font-size: 36px; }
.meta { margin: 0 0 10px; color: var(--muted); }
.desc { margin: 0 0 18px; line-height: 1.55; max-width: 62ch; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: white; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; font-weight: 600;
}
.chip-dot { width: 12px; height: 12px; border-radius: 99px; }

.stat, .form-card, .note, .empty { border-radius: 22px; padding: 18px; }
.stat b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 560; }
.stat span { color: var(--muted); }
.form-card h2, .note strong { font-family: var(--sans); letter-spacing: 0; margin: 0; }
.narrow { max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 14px; padding: 12px 14px; color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
input[type="color"] { height: 48px; padding: 6px; }
.check { flex-direction: row; align-items: center; font-weight: 600; }
.check input { width: auto; }
.filter-label { max-width: 320px; margin: 8px 0 14px; }
.table-wrap { overflow: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid #f0e8dc; vertical-align: middle; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.actions form { margin: 0; }
.linkish, button.linkish { background: none; border: 0; padding: 0; color: var(--copper-deep); font-weight: 700; cursor: pointer; text-decoration: none; }
.danger { color: #9c3b3b; }
.note p { margin: 8px 0 0; line-height: 1.5; white-space: pre-wrap; }
.flash { padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; background: #e7f2ea; color: #1d4632; }
.flash.error { background: #fde8e4; color: #6f2c22; }
.empty { color: var(--muted); }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-aside {
  position: relative; overflow: hidden; padding: 36px;
  background: linear-gradient(165deg, #1b332b, #101c18 70%);
  color: #f6f1e8; display: flex; flex-direction: column;
}
.login-aside::after {
  content: ""; position: absolute; width: 320px; height: 320px; right: -90px; bottom: -80px;
  border: 42px solid rgba(255, 250, 243, 0.05); border-radius: 56px;
}
.login-copy { margin-top: auto; position: relative; z-index: 1; max-width: 460px; }
.login-copy h1 { font-size: 46px; line-height: 1.02; margin: 0 0 18px; }
.login-copy ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.login-copy li { padding-left: 16px; position: relative; color: rgba(246, 241, 232, 0.82); }
.login-copy li::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: #e0b08a; position: absolute; left: 0; top: .55em; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: min(420px, 100%); }
.login-box h2 { margin: 0 0 8px; font-size: 40px; }
.login-box .lede { margin-bottom: 18px; }
.icon-button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: white; display: grid; place-items: center; }

@media (max-width: 1100px) {
  .grid-cats, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-materials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 30; width: min(86vw, 320px); transform: translateX(-105%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 24, 20, .45); z-index: 20; }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10;
    padding: 12px 16px; background: rgba(243, 238, 230, .92); backdrop-filter: blur(10px);
  }
  .content { width: min(100% - 32px, 1120px); padding-top: 22px; }
  .detail, .form-grid, .login-screen { grid-template-columns: 1fr; }
  .login-copy h1, .page-head h1, .detail h1 { font-size: 32px; }
  .login-aside { min-height: auto; padding-bottom: 28px; }
  .login-copy { margin-top: 28px; }
}
@media (max-width: 560px) {
  .grid-cats, .grid-materials, .stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

:root {
  --ink: #2a211c;
  --paper: #fbf6f1;
  --card: #ffffff;
  --line: #f0e2d4;
  --copper: #ef5d4a;
  --copper-deep: #d63e2e;
  --violet: #6d4dff;
  --sage: #1f9d62;
  --text: #2a241f;
  --muted: #7d746c;
  --shadow: 0 10px 28px rgba(80, 50, 40, 0.08);
}
body {
  background:
    radial-gradient(540px 320px at 0% -10%, rgba(255, 128, 168, 0.28), transparent 60%),
    radial-gradient(520px 340px at 100% 0%, rgba(124, 164, 255, 0.26), transparent 58%),
    radial-gradient(480px 300px at 90% 100%, rgba(120, 214, 160, 0.22), transparent 55%),
    radial-gradient(420px 260px at 10% 100%, rgba(255, 196, 120, 0.22), transparent 50%),
    var(--paper);
}
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.sidebar {
  background: #fffdfb;
  color: #2a241f;
  border-right: 1px solid #f0e4d8;
}
.brand strong { color: #2a211c; }
.brand small { color: #7d746c; }
.side-link { color: #4e463f; }
.side-link:hover { background: #f6efe8; color: #2a211c; }
.side-link.is-active { background: var(--violet); color: #fff; }
.side-link.is-active svg { color: #fff; }
.user-card { background: #f7f0e8; }
.user-card span { color: #6f675c; }
.user-card button { color: var(--violet); }
.cat-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: #3a2418;
  box-shadow: inset 0 -10px 0 rgba(255, 255, 255, 0.35);
}
.cat-icon-lg { background: #fff; }
.chip-dot { width: 14px; height: 14px; }
.login-aside {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 0;
  background: #ffd7c2;
  color: #2a211c;
  display: flex;
}
.login-aside::after { display: none; }
.login-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.login-aside .brand {
  position: relative;
  z-index: 2;
  margin: 22px;
  align-self: flex-start;
  height: fit-content;
  background: rgba(255, 252, 248, 0.94);
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(60, 30, 20, 0.14);
}
.login-copy { display: none; }
.btn-soft { background: #fff1ea; color: #6a3d32; }
.material-card:hover .btn-soft { background: var(--violet); color: #fff; }
.panel-actions { margin: 18px 0 22px; }
.field-hint { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.45; }
.current-file { margin: 0; padding: 12px 14px; border-radius: 14px; background: #fff4ec; font-size: 14px; line-height: 1.4; }
.cover-preview { width: 240px; aspect-ratio: 16 / 10; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff4ec; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 860px) {
  .login-aside { min-height: 0; height: 240px; padding: 0; }
  .login-aside .brand { margin: 12px; }
}
