:root {
  --bg: #0f0d09;
  --panel: #18140d;
  --panel-2: #221b10;
  --line: #5a4524;
  --text: #fff8e6;
  --muted: #d7c49a;
  --soft: #a88645;
  --accent: #d6a84f;
  --accent-2: #f3d37a;
  --danger: #ff8a8a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(214, 168, 79, 0.14), transparent 30%),
    linear-gradient(135deg, #0c0a07 0%, #17120b 45%, #251b0e 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) 170px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 13, 9, 0.92);
  backdrop-filter: blur(16px);
}

.brand,
.account,
.search {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

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

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff1a6, #d6a84f 48%, #8a6425);
  color: #1a1308;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 8px 18px rgba(214, 168, 79, 0.22);
}

.search {
  position: relative;
  padding: 10px 14px;
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #14100a;
  color: var(--text);
  padding: 0 14px;
  outline: 0;
}

.search input:focus {
  border-color: var(--accent);
}

.account {
  border-right: 0;
  border-left: 1px solid var(--line);
}

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

.logout-link {
  color: var(--muted);
  text-decoration: none;
}

.logout-link:hover {
  color: var(--text);
}

.nav {
  display: flex;
  gap: 8px;
  align-items: center;
  height: 54px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 20, 13, 0.92);
  overflow-x: auto;
}

.nav a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
}

.nav a.active,
.nav a:hover {
  background: rgba(214, 168, 79, 0.14);
  color: #fff1a6;
}

.layout {
  padding: 20px 22px 42px;
}

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

.crumb {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
}

h2 {
  font-size: 16px;
  margin-bottom: 7px;
}

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

.segmented button {
  border: 0;
  border-right: 1px solid var(--soft);
  background: transparent;
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 800;
}

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

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

.segmented button.active,
.segmented button:hover {
  background: rgba(214, 168, 79, 0.18);
  color: #fff1a6;
}

.overview-panel,
.metric,
.create-panel,
.links-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(43, 34, 19, 0.96), rgba(24, 20, 13, 0.96));
  box-shadow: var(--shadow);
}

.overview-panel {
  min-height: 150px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 1.6fr;
  gap: 24px;
  align-items: end;
  padding: 28px 14px 14px;
}

.overview-panel p,
.section-title p,
.metric small {
  color: var(--muted);
  margin-bottom: 0;
}

.filters {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  align-self: start;
}

.filters span {
  border: 1px solid var(--line);
  background: rgba(214, 168, 79, 0.08);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
}

.filters strong {
  color: var(--text);
}

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

.metric {
  min-height: 86px;
  padding: 14px;
}

.metric span {
  display: block;
  text-transform: uppercase;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 6px 0;
  font-size: 28px;
  line-height: 1;
}

.metric.wide {
  grid-column: span 2;
}

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

.create-panel,
.links-panel {
  padding: 16px;
}

.create-panel {
  display: grid;
  align-content: start;
  gap: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #14100a;
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.primary,
.icon,
.link-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #17120b;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.primary {
  min-height: 42px;
  background: linear-gradient(135deg, #ffe69a, #d6a84f 52%, #916a28);
  border-color: #f3d37a;
  color: #171008;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 24px rgba(214, 168, 79, 0.22);
}

.message {
  min-height: 18px;
  color: var(--accent-2);
  margin: 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.row-title {
  display: block;
  margin-bottom: 5px;
}

.link-button {
  padding: 6px 8px;
  color: #f3d37a;
}

.destination {
  color: var(--muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain {
  color: #f3d37a;
  font-weight: 800;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(214, 168, 79, 0.16);
  color: #ffe69a;
  font-weight: 900;
}

.status.inactive {
  background: rgba(255, 138, 138, 0.14);
  color: var(--danger);
}

.actions {
  display: flex;
  gap: 7px;
}

.icon {
  min-height: 32px;
  padding: 0 10px;
}

.delete {
  border-color: rgba(255, 138, 138, 0.5);
  color: var(--danger);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(214, 168, 79, 0.16), transparent 22%),
    radial-gradient(circle at 16% 12%, rgba(243, 211, 122, 0.12), transparent 28%),
    linear-gradient(135deg, #080604, #18120a 48%, #2a1d0d);
}

.login-shell {
  width: min(430px, 100%);
}

.login-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(45, 35, 18, 0.98), rgba(20, 16, 10, 0.98));
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 241, 166, 0.22), transparent 34%, rgba(214, 168, 79, 0.12));
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}

.login-brand h1 {
  font-size: 22px;
}

.login-brand p {
  color: var(--muted);
  margin-bottom: 0;
}

.login-error {
  border: 1px solid rgba(255, 138, 138, 0.5);
  border-radius: 6px;
  background: rgba(255, 138, 138, 0.12);
  color: var(--danger);
  padding: 10px 12px;
  margin-bottom: 0;
}

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

  .brand,
  .account,
  .search {
    min-height: 48px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-head,
  .overview-panel {
    display: block;
  }

  .segmented,
  .filters {
    margin-top: 14px;
  }

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

  .metric.wide {
    grid-column: auto;
  }
}
