:root {
  --bg: #f4efe7;
  --panel: rgba(255, 251, 246, 0.88);
  --panel-strong: #fffaf4;
  --line: rgba(62, 42, 24, 0.12);
  --line-strong: rgba(62, 42, 24, 0.22);
  --text: #22170f;
  --muted: #6d5a4a;
  --accent: #ef5a29;
  --accent-deep: #cc4313;
  --success: #176f42;
  --danger: #9f2f21;
  --shadow: 0 18px 40px rgba(50, 26, 10, 0.08);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(239, 90, 41, 0.16), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(120, 86, 52, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre {
  font-family: 'IBM Plex Sans', monospace;
}

h1,
h2,
h3,
strong {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.03em;
}

button,
input,
select,
textarea {
  font: inherit;
}

body {
  line-height: 1.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(248, 241, 233, 0.72);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 4px;
}

.brand-block p,
.muted,
small {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.sidebar-nav a {
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--muted);
  transition: 0.18s ease;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(239, 90, 41, 0.12);
  color: var(--text);
}

.sidebar-foot {
  margin-top: 24px;
}

.main-shell {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.topbar,
.section-head,
.hero-strip,
.list-item,
.topbar-actions,
.filter-actions,
.form-actions,
.inline-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  align-items: flex-start;
}

.topbar h1,
.hero-strip h2,
.section-head h3,
.login-copy h1,
.login-card h2 {
  margin: 0;
}

.topbar-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

.hero-strip,
.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-strip {
  padding: 28px;
}

.hero-note {
  min-width: 200px;
  display: grid;
  justify-items: end;
}

.hero-note strong {
  font-size: 3rem;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-panel {
  padding: 18px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.24));
  border: 1px solid var(--line);
  border-radius: 20px;
}

.metric-panel span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-panel strong {
  display: block;
  font-size: 1.6rem;
}

.panel {
  padding: 24px;
}

.workspace-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td small,
.list-item small,
.badge,
.pill {
  display: block;
}

.badge,
.pill {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 23, 15, 0.07);
  color: var(--text);
  font-size: 0.78rem;
}

.pill.subtle {
  background: rgba(239, 90, 41, 0.1);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.list-values {
  text-align: right;
}

.tag-cloud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tag-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.tag-card strong {
  font-size: 1.5rem;
  display: block;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.wide-form {
  gap: 18px;
}

.form-grid,
.filter-grid,
.rules-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rules-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(239, 90, 41, 0.55);
  box-shadow: 0 0 0 4px rgba(239, 90, 41, 0.08);
}

textarea {
  resize: vertical;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.ghost-button {
  background: rgba(34, 23, 15, 0.06);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.flash.success {
  background: rgba(23, 111, 66, 0.12);
  color: var(--success);
}

.flash.error {
  background: rgba(159, 47, 33, 0.1);
  color: var(--danger);
}

.code-block {
  padding: 16px;
  border-radius: 18px;
  background: #1f1813;
  color: #f8ece1;
  overflow: auto;
}

.code-block pre {
  margin: 0;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: stretch;
}

.login-copy {
  padding: 36px;
  border-radius: 28px;
  background:
    linear-gradient(155deg, rgba(239, 90, 41, 0.94), rgba(153, 58, 19, 0.9)),
    var(--accent);
  color: #fff5ef;
  min-height: 520px;
  display: grid;
  align-content: end;
  box-shadow: var(--shadow);
}

.login-copy .topbar-label,
.login-copy p {
  color: rgba(255, 245, 239, 0.78);
}

.login-card {
  padding: 30px;
  display: grid;
  align-content: center;
}

@media (max-width: 1120px) {
  .metric-grid,
  .metric-grid.compact,
  .form-grid,
  .filter-grid,
  .tag-cloud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 720px) {
  .main-shell {
    padding: 18px;
  }

  .panel,
  .hero-strip,
  .login-copy,
  .login-card {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .hero-strip,
  .list-item,
  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .metric-grid.compact,
  .form-grid,
  .filter-grid,
  .rules-grid,
  .tag-cloud {
    grid-template-columns: 1fr;
  }

  th,
  td {
    min-width: 120px;
  }
}
