:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1c2230;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: #17211d;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}
.sidebar__brand { font-weight: 700; font-size: 20px; margin-bottom: 32px; }
.sidebar__brand span { color: #8fd6bd; font-weight: 500; font-size: 14px; display: block; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar__nav a {
  color: #cfd8d4;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.sidebar__nav a:hover { background: #223029; }
.sidebar__nav a.is-active { background: var(--accent); color: #fff; }
.sidebar__logout { color: #cfd8d4; text-decoration: none; font-size: 13px; padding: 10px 12px; }
.sidebar__logout:hover { color: #fff; }

.content { flex: 1; padding: 32px 40px; overflow-x: auto; }
.page-title { font-size: 22px; margin: 0 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.muted { color: var(--muted); font-weight: 400; font-size: 15px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash--ok { background: #e3f2ec; color: #14532d; }
.flash--err { background: #fdecea; color: var(--danger); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card__num { font-size: 28px; font-weight: 700; }
.stat-card__label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel__title { font-size: 15px; margin: 0 0 12px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.table--rows { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-actions { display: flex; gap: 12px; }
.link { color: var(--accent); text-decoration: none; font-size: 13px; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.link--danger { color: var(--danger); }
.link:hover { text-decoration: underline; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--block { width: 100%; }

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 13px; }
.pagination a.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination__ellipsis { border: none; color: var(--muted); padding: 6px 2px; }
.pagination__nav.is-disabled { pointer-events: none; opacity: .4; }

.form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field--wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; color: var(--ink);
}
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.auth-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: radial-gradient(circle at 15% 20%, #24372e 0%, #17211d 55%, #0f1712 100%);
  padding: 24px;
}

.auth-shell {
  display: flex; width: min(920px, 100%);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,.45);
}

.auth-visual {
  position: relative; flex: 1.1; overflow: hidden;
  background: linear-gradient(160deg, #1c2921 0%, #172119 70%);
  color: #eaf3ee; padding: 40px; min-height: 480px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-visual__brand { font-size: 15px; font-weight: 600; letter-spacing: .02em; position: relative; z-index: 2; }
.auth-visual__brand span { color: #8fd6bd; }
.auth-visual__caption { position: relative; z-index: 2; max-width: 30ch; font-size: 14px; line-height: 1.6; color: #cfe3d9; }

.auth-bg__word {
  position: absolute; left: -6%; top: 46%; transform: translateY(-50%) rotate(-6deg);
  font-family: 'IBM Plex Serif', serif; font-weight: 700;
  font-size: clamp(70px, 15vw, 168px); letter-spacing: .01em; white-space: nowrap;
  color: rgba(143, 214, 189, 0.10); user-select: none; z-index: 1;
}
.auth-bg__icon { position: absolute; color: rgba(143, 214, 189, 0.19); z-index: 1; }
.auth-bg__icon--book   { top: 26px;  right: -14px; width: 110px; transform: rotate(6deg); }
.auth-bg__icon--spiral { top: 108px; left: 10px;   width: 56px;  transform: rotate(-8deg); }
.auth-bg__icon--stack  { top: 148px; right: 22px;  width: 88px;  transform: rotate(-5deg); }
.auth-bg__icon--pencil { top: 226px; left: -8px;   width: 140px; transform: rotate(11deg); }

.auth-card {
  background: var(--panel); padding: 40px 36px; width: 360px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 14px; justify-content: center;
}
.auth-card__title { margin: 0; font-size: 20px; }
.auth-card__sub { margin: -8px 0 4px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .auth-shell { flex-direction: column; width: min(400px, 100%); }
  .auth-visual { min-height: 150px; padding: 24px; }
  .auth-visual__caption { display: none; }
  .auth-card { width: 100%; }
}

@media (max-width: 720px) {
  .stat-grid, .panel-grid, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}
