:root {
  --bg-page: #ECE9DF;
  --bg-chrome: #FAF9F5;
  --bg-surface: #FFFFFF;
  --text-primary: #1A1612;
  --text-secondary: #6B6660;
  --text-tertiary: #8E8A82;
  --border-light: rgba(26, 22, 18, 0.08);
  --border-medium: rgba(26, 22, 18, 0.16);
  --accent: #B85C3F;
  --accent-hover: #A04E33;
  --status-ok: #4A7C3D;
  --status-err: #A85040;
  --status-off: #8E8A82;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --radius-sm: 5px;
  --radius-md: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

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

a:hover {
  color: var(--text-primary);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.015em;
}

button,
input,
select {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login-panel {
  width: 300px;
}

.login-brand {
  margin-bottom: 36px;
  text-align: center;
}

.login-title {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.app {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg-surface);
}

.sidebar {
  width: 170px;
  background: var(--bg-chrome);
  border-right: 0.5px solid var(--border-light);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-brand {
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: -0.01em;
  padding: 0 8px 24px;
}

.nav-item,
.nav-form button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  color: var(--text-secondary);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-form button:hover {
  background: rgba(0, 0, 0, 0.03);
}

.nav-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-spacer {
  flex: 1;
}

.nav-user {
  padding: 0 10px 10px;
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.content {
  min-width: 0;
  padding: 32px 36px;
  background: var(--bg-surface);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.page-meta {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 32px;
}

.breadcrumb {
  color: var(--text-tertiary);
  display: inline-block;
  font-size: 12px;
  margin-bottom: 6px;
}

.muted {
  color: var(--text-secondary);
}

.muted2,
.hint {
  color: var(--text-tertiary);
  font-size: 12px;
}

.hint {
  margin-top: 6px;
}

.error {
  color: var(--status-err);
  font-size: 13px;
  margin-bottom: 18px;
}

.btn,
.btn-ghost {
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  white-space: nowrap;
}

.btn {
  background: var(--accent);
  border: none;
  color: #FFFFFF;
}

.btn:hover {
  background: var(--accent-hover);
  color: #FFFFFF;
}

.btn-ghost {
  background: transparent;
  border: 0.5px solid var(--border-medium);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background: var(--bg-chrome);
}

.input {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  border: 0.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(184, 92, 63, 0.12);
}

.input:disabled {
  background: var(--bg-chrome);
  color: var(--text-secondary);
}

.label {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 7px;
}

.field {
  margin-bottom: 18px;
}

.form-narrow {
  max-width: 380px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: 720px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  text-align: left;
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border-light);
}

.tbl td {
  padding: 14px 0;
  border-bottom: 0.5px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: top;
}

.tbl .right {
  text-align: right;
}

.category {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.status {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  vertical-align: 2px;
  margin-right: 6px;
}

.status-ok {
  background: var(--status-ok);
}

.status-err {
  background: var(--status-err);
}

.status-off {
  background: var(--status-off);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding: 4px 0 28px;
  border-bottom: 0.5px solid var(--border-light);
  margin-bottom: 24px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 0.5px solid var(--border-light);
}

.list-row:last-child {
  border-bottom: 0;
}

.list-title {
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-bottom: 20px;
  animation: spin 0.9s linear infinite;
}

.center-state {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty {
  color: var(--text-tertiary);
  font-family: var(--font-serif);
  font-size: 15px;
  padding: 28px 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 0.5px solid var(--border-light);
  }

  .content {
    padding: 24px 20px;
  }

  .page-header,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
