:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f0f2ed;
  --text: #171717;
  --muted: #686b63;
  --line: #dedfd8;
  --primary: #171717;
  --accent: #c59b2b;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(23, 23, 23, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

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

.public-shell {
  width: min(920px, calc(100% - 32px));
}

.topbar,
.public-head,
.section-head,
.button-row,
.top-actions,
.inline-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.public-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.panel,
.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.notice {
  margin-bottom: 18px;
  padding: 18px 20px;
}

.notice:empty {
  display: none;
}

.auth-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.auth-panel p,
.empty-state p {
  color: var(--muted);
  margin-top: 6px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.split {
  align-items: flex-start;
}

.count {
  display: inline-grid;
  min-width: 32px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}

.create-form,
.config-grid {
  display: grid;
  gap: 10px;
}

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

.wide {
  grid-column: 1 / -1;
}

label span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
.editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(197, 155, 43, 0.16);
}

.button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  padding: 0 14px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
  white-space: nowrap;
}

.button:hover {
  border-color: #c9cabf;
  transform: translateY(-1px);
}

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

.button.ghost {
  background: var(--surface-2);
}

.button.danger {
  color: var(--danger);
}

.button.full {
  width: 100%;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented label {
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 8px rgba(23, 23, 23, 0.08);
}

.site-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.site-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.site-item.active {
  border-color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.site-item strong,
.site-item span {
  display: block;
}

.site-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.detail {
  min-width: 0;
}

.detail > div,
#detailPanel {
  display: grid;
  gap: 18px;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-content: center;
  text-align: center;
}

.copy-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-toolbar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 0 10px;
}

.editor {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  line-height: 1.65;
  outline: none;
}

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

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

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

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

td {
  line-height: 1.45;
}

.log-feed {
  display: grid;
  gap: 10px;
}

.log-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.log-message {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

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

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #171717;
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
  }

  .auth-panel,
  .topbar,
  .public-head,
  .split {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form,
  .top-actions,
  .button-row {
    flex-wrap: wrap;
  }

  .config-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
