:root {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --ink: #18221d;
  --muted: #667369;
  --line: #d8dfd8;
  --accent: #287c5a;
  --accent-strong: #176043;
  --warn: #b65f1a;
  --danger: #b33434;
  --shadow: 0 10px 28px rgb(24 34 29 / 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
.button-link {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

button:hover,
.button-link:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.secondary {
  background: #eef2ed;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: #e4ebe3;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 72px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  font-weight: 800;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

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

.badge {
  border: 1px solid var(--line);
  background: #f4f6f3;
  border-radius: 999px;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 7px 12px;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 18px;
}

.form,
.inline-form,
.admin-grid {
  display: grid;
  gap: 14px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.admin-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  font-size: 24px;
  color: var(--accent-strong);
}

.quote {
  border: 1px solid #e3c99e;
  background: #fff8ec;
  color: #6f431a;
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.message {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.error {
  border-color: #efc0c0;
  background: #fff5f5;
  color: var(--danger);
}

.message.success {
  border-color: #add4bf;
  background: #effaf3;
  color: var(--accent-strong);
}

.orders {
  display: grid;
  gap: 10px;
}

.order {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.order-main {
  display: grid;
  gap: 6px;
}

.order-title {
  font-weight: 800;
}

.order-meta {
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

.status {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--warn);
  background: #fff8ec;
}

.code {
  font-size: 22px;
  font-weight: 900;
  color: var(--accent-strong);
}

.output {
  min-height: 92px;
  max-height: 320px;
  overflow: auto;
  background: #17221d;
  color: #e8efe9;
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .grid,
  .auth-grid,
  .admin-grid,
  .order {
    grid-template-columns: 1fr;
  }

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

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