:root {
  --bg: #f7f4ef;
  --panel: #fffdf9;
  --panel-2: #efe7dc;
  --text: #2f2924;
  --muted: #7a7067;
  --line: #ded3c5;
  --gold: #b9852f;
  --green: #2f8f5b;
  --red: #b94b3f;
  --dark: #2c251f;
  --shadow: 0 18px 48px rgba(47, 41, 36, 0.1);
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Inter", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
}

body.is-locked {
  overflow: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #2c251f, #594638);
}

.login-screen.is-hidden {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
}

.login-card img {
  width: 86px;
  height: 86px;
  margin-bottom: 16px;
  object-fit: contain;
}

.login-card h1 {
  margin-bottom: 22px;
}

.login-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-card input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.login-card .primary-button {
  width: 100%;
}

.login-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

button,
input,
select {
  font: inherit;
}

.erp-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  overflow: auto;
  padding: 24px 18px;
  background: var(--dark);
  color: #f8f1e8;
}

.erp-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-size: 28px;
}

.erp-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: brightness(1.15);
}

.erp-nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.erp-nav button {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  cursor: pointer;
}

.erp-nav button:hover,
.erp-nav button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.erp-main {
  min-height: 100vh;
  margin-left: 260px;
  padding: 28px;
}

.erp-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
}

h1 {
  font-size: 50px;
  line-height: 1;
}

h2 {
  font-size: 30px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.danger-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}

.primary-button {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.ghost-button {
  background: var(--panel);
  color: var(--text);
}

.danger-button {
  border-color: rgba(185, 75, 63, 0.3);
  background: rgba(185, 75, 63, 0.1);
  color: var(--red);
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  background: #f7f0e8;
  color: var(--text);
  font-size: 12px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.metric {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 30px;
}

.metric small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.panel-grid > .panel:only-child {
  grid-column: 1 / -1;
}

.panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-head p,
.panel-head span {
  margin: 6px 0 0;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td strong {
  color: var(--text);
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eee5da;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.status.good {
  background: rgba(47, 143, 91, 0.13);
  color: var(--green);
}

.status.bad {
  background: rgba(185, 75, 63, 0.13);
  color: var(--red);
}

.status.warn {
  background: rgba(185, 133, 47, 0.16);
  color: #906113;
}

.inline-select,
.inline-input {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.erp-form {
  display: grid;
  gap: 13px;
}

.erp-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.erp-form input,
.erp-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.alert-list,
.log-list,
.bar-list {
  display: grid;
  gap: 12px;
}

.alert-item,
.log-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbf7f1;
}

.alert-item strong,
.log-item strong {
  display: block;
  margin-bottom: 3px;
}

.alert-item span,
.log-item span {
  color: var(--muted);
  font-size: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfD2;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #d6ad65);
}

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbf7f1;
}

@media (max-width: 1040px) {
  .erp-sidebar {
    position: static;
    width: auto;
  }

  .erp-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .erp-main {
    margin-left: 0;
  }

  .metric-grid,
  .panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .erp-topbar,
  .panel-head {
    display: block;
  }

  .top-actions {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .erp-nav,
  .metric-grid,
  .panel-grid,
  .form-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 40px;
  }
}
