/*
  Components ported from docs/frontend-style-guide.md, plus a few new ones
  (nav tabs, table, buttons, inputs) needed for a multi-section admin app
  that the guide itself doesn't cover (it's written for one centered status
  card) -- built with the same tokens/typography/radius conventions so they
  read as part of the same system.
*/

/* -- Page layout: guide section 10, used as-is on the login page -- */
.wrap {
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

.center-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 14px;
}

/* -- Topline / footline: guide section 9 -- */
.topline,
.footline {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  width: 100%;
}

.topline .warn,
.footline .warn {
  color: var(--accent-foreground);
}

/* -- Card: guide section 4 -- */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--gold);
  opacity: 0.7;
  pointer-events: none;
}
.corner.tl {
  top: -1px;
  left: -1px;
  border-top: 1.5px solid var(--gold);
  border-left: 1.5px solid var(--gold);
}
.corner.tr {
  top: -1px;
  right: -1px;
  border-top: 1.5px solid var(--gold);
  border-right: 1.5px solid var(--gold);
}
.corner.bl {
  bottom: -1px;
  left: -1px;
  border-bottom: 1.5px solid var(--gold);
  border-left: 1.5px solid var(--gold);
}
.corner.br {
  bottom: -1px;
  right: -1px;
  border-bottom: 1.5px solid var(--gold);
  border-right: 1.5px solid var(--gold);
}

.card-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 28px 32px 32px;
}

.title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground-bright);
  margin: 6px 0 0;
}

.subtitle {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-foreground);
  max-width: 46ch;
  margin: 6px 0 0;
}

/* -- Status indicator: guide section 5 -- */
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
  flex-shrink: 0;
}

.status-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent-foreground);
  text-transform: uppercase;
}

/* -- Field rows (key/value): guide section 6 -- */
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.field-row:last-child {
  border-bottom: none;
}
.field-row .k {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.field-row .v {
  color: var(--foreground);
  text-align: right;
}

/* -- Badges: guide section 7, plus danger/warning/ok variants (see theme.css note) -- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted-foreground);
  white-space: nowrap;
}
.badge.danger {
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(185, 28, 28, 0.1);
  color: var(--status-danger-foreground);
}
.badge.warning {
  border-color: rgba(180, 83, 9, 0.35);
  background: rgba(180, 83, 9, 0.12);
  color: var(--status-warning-foreground);
}
.badge.ok {
  border-color: rgba(21, 128, 61, 0.35);
  background: rgba(21, 128, 61, 0.1);
  color: var(--status-ok-foreground);
}

/* -- Divider note: guide section 8 -- */
.divider-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted-foreground);
}
.divider-note code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gold-foreground);
  background: rgba(166, 124, 30, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(166, 124, 30, 0.2);
}

/* -- Forms (new, same conventions: mono uppercase labels, radius 6px) -- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
input,
select {
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 9px 11px;
  font: inherit;
  outline: none;
  transition: border-color 0.12s ease;
}
input:focus,
select:focus {
  border-color: var(--gold);
}
input::placeholder {
  color: var(--muted);
}

.error-text {
  font-size: 12.5px;
  color: var(--status-danger-foreground);
  min-height: 1.2em;
}

/* -- Buttons (new) -- */
button {
  font: inherit;
  cursor: pointer;
}
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--panel-raised);
  color: var(--foreground);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-weight: 500;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.btn:hover {
  border-color: var(--gold);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--foreground-bright);
}
.btn-primary:hover {
  filter: brightness(1.1);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover {
  color: var(--foreground);
  border-color: var(--border-strong);
}
.btn-full {
  width: 100%;
}

/* -- App shell: top nav + content (new, not in the guide) -- */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.shell-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.shell-brand {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.shell-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}
.shell-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted-foreground);
  padding: 7px 13px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.shell-tab:hover {
  color: var(--foreground);
  background: var(--panel-raised);
}
.shell-tab.active {
  color: var(--foreground-bright);
  background: var(--panel-raised);
  border-color: var(--border-strong);
}
.shell-content {
  flex: 1;
  overflow: auto;
  padding: 28px;
}

/* -- Table (new) -- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--foreground);
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: rgba(148, 163, 184, 0.03);
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted-foreground);
}
.muted {
  color: var(--muted);
}
.empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

/* -- Truncated, click-to-copy key string (new) -- */
.key-string {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  cursor: pointer;
}
.key-string:hover {
  color: var(--foreground);
  text-decoration: underline dotted;
}
.key-string.copied {
  color: var(--status-ok-foreground);
}

/* -- Banners, form grid, row actions (new) -- */
.banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.banner-error {
  background: rgba(185, 28, 28, 0.1);
  border: 1px solid rgba(185, 28, 28, 0.35);
  color: var(--status-danger-foreground);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.section-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
