:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #172026;
  --muted: #62707c;
  --line: #d9e0e6;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --danger: #c2410c;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Arial, Helvetica, sans-serif;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #172026;
  color: #f7fafc;
  padding: 22px;
}

.sidebar a {
  color: #f7fafc;
  display: block;
  padding: 9px 10px;
  border-radius: var(--radius);
  margin: 4px 0;
}

.sidebar a:hover,
.sidebar .active {
  background: #25323a;
  text-decoration: none;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
}

.content {
  padding: 26px;
  max-width: 1280px;
  width: 100%;
}

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

.grid {
  display: grid;
  gap: 14px;
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

a.card {
  color: inherit;
  text-decoration: none;
  display: block;
}

a.card:hover {
  border-color: var(--accent);
}

details.card {
  padding: 0;
}

details.card > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px;
  font-size: 24px;
  font-weight: 700;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

details.card > summary::-webkit-details-marker {
  display: none;
}

details.card > summary::after {
  content: "Развернуть";
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

details.card[open] > summary {
  border-bottom: 1px solid var(--line);
}

details.card[open] > summary::after {
  content: "Свернуть";
}

details.card > form,
details.card > .collapsible-body {
  padding: 16px;
}

.metric {
  font-size: 28px;
  font-weight: 700;
}

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

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: var(--surface-2);
}

.status.active,
.status.assigned,
.status.free {
  color: var(--ok);
  background: #dcfce7;
}

.status.expiring {
  color: var(--warn);
  background: #fef3c7;
}

.status.expired,
.status.suspended,
.status.failed {
  color: var(--danger);
  background: #ffedd5;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

th {
  background: var(--surface-2);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

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

button,
.button,
input[type="submit"] {
  border: 0;
  border-radius: var(--radius);
  padding: 9px 12px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font: inherit;
}

.button.secondary,
button.secondary {
  background: #465660;
}

.button.danger,
button.danger {
  background: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  font: inherit;
  background: white;
  color: var(--text);
}

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

form.inline {
  display: inline;
}

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

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

.login {
  max-width: 520px;
  margin: 8vh auto;
  padding: 24px;
}

.notice {
  border-left: 4px solid var(--brand);
  background: var(--surface);
  padding: 12px;
  margin: 12px 0;
}

.price-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.price-line.total {
  font-weight: 700;
  border-bottom: 0;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .grid.cols-2,
  .grid.cols-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
