:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: #ffffff;
  --text: #202227;
  --muted: #626775;
  --accent: #1947e5;
  --accent-soft: rgba(25, 71, 229, 0.1);
  --border: rgba(32, 34, 39, 0.12);
  --shadow: 0 18px 54px rgba(25, 71, 229, 0.1);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(25, 71, 229, 0.12),
      transparent 34%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(15, 138, 108, 0.14),
      transparent 30%
    ),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

a {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.admin-shell {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

.admin-shell.is-collapsed {
  grid-template-columns: 4rem minmax(0, 1fr);
}

.admin-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1rem;
  padding: 0.8rem;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
}

.sidebar-header,
.compact-topbar,
.topbar-actions,
.detail-header,
.brand,
.nav-list button,
.nav-button,
.icon-button,
.primary-button,
.sync-label,
.list-item {
  display: flex;
  align-items: center;
}

.sidebar-header {
  justify-content: space-between;
  gap: 0.4rem;
}

.brand {
  min-width: 0;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.brand span,
.nav-list span,
.nav-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.nav-list button,
.nav-button {
  border: 0;
  color: var(--text);
  background: transparent;
}

.icon-button {
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border-radius: 0.45rem;
}

.icon-button:hover,
.nav-list button:hover,
.nav-button:hover,
.nav-list button.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-list {
  display: grid;
  gap: 0.25rem;
}

.nav-list button,
.nav-button {
  min-width: 0;
  min-height: 2.25rem;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  text-align: left;
}

.nav-button {
  margin-top: auto;
}

.admin-shell.is-collapsed .brand span,
.admin-shell.is-collapsed .nav-list span,
.admin-shell.is-collapsed .nav-button span {
  display: none;
}

.admin-shell.is-collapsed .sidebar-header,
.admin-shell.is-collapsed .nav-list button,
.admin-shell.is-collapsed .nav-button {
  justify-content: center;
}

.admin-main {
  min-width: 0;
  padding: 0.85rem;
}

.compact-topbar {
  min-height: 3rem;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.compact-topbar > div:first-child {
  display: grid;
  gap: 0.1rem;
}

.section-label {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  gap: 0.55rem;
}

.sync-label {
  gap: 0.4rem;
  min-height: 2.1rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.92rem;
}

.primary-button {
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  color: white;
  background: var(--accent);
}

.sync-button {
  width: 2.25rem;
  padding-inline: 0;
  flex: 0 0 auto;
}

.sync-button span {
  display: none;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) clamp(11.5rem, 20vw, 15rem);
  gap: 0.65rem;
  min-height: calc(100vh - 4.8rem);
}

.column-browser {
  display: grid;
  grid-auto-columns: minmax(11rem, 1fr);
  grid-auto-flow: column;
  gap: 0.65rem;
  min-width: 0;
  overflow-x: auto;
}

.browser-column,
.detail-panel,
.login-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.browser-column,
.detail-panel {
  overflow: hidden;
}

.browser-column > header,
.detail-header {
  min-height: 2.5rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-header {
  gap: 0.45rem;
}

.item-list {
  display: grid;
  gap: 0.15rem;
  padding: 0.45rem;
}

.list-item {
  width: 100%;
  min-width: 0;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.5rem;
  border: 0;
  border-radius: 0.42rem;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.list-item:hover,
.list-item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.list-item span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.user-column {
  min-height: 22rem;
}

.detail-panel {
  padding-bottom: 0.9rem;
}

.detail-panel h2 {
  margin: 0.85rem 0.85rem 0.35rem;
  font-size: 1.45rem;
  line-height: 1.05;
}

.open-link {
  display: inline-flex;
  margin: 0 0.85rem 0.7rem;
  font-size: 0.95rem;
}

.detail-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0.85rem;
}

.detail-list.compact {
  margin-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.detail-list div {
  min-width: 0;
}

.detail-list dt {
  margin-bottom: 0.16rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stack-form {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.stack-form input,
.stack-form select,
.login-panel input {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.empty-state {
  margin: 0;
  padding: 0.8rem;
  color: var(--muted);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.login-panel {
  display: grid;
  width: min(23rem, 100%);
  gap: 0.75rem;
  padding: 1rem;
}

.login-panel h1 {
  margin: 0;
  font-size: 1.6rem;
}

.login-panel label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
}

.login-mark {
  display: inline-flex;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  color: white;
  background: var(--accent);
}

.form-error {
  margin: 0;
  color: #a43131;
}

@media (max-width: 1080px) {
  .admin-shell,
  .admin-shell.is-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    align-items: center;
  }

  .nav-list {
    display: flex;
  }

  .nav-button {
    margin-top: 0;
  }

  .admin-shell.is-collapsed .brand span,
  .admin-shell.is-collapsed .nav-list span,
  .admin-shell.is-collapsed .nav-button span {
    display: inline;
  }

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

  .sync-label {
    display: none;
  }

  .column-browser {
    min-height: 18rem;
  }
}

@media (max-width: 640px) {
  .admin-sidebar,
  .compact-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sidebar-header,
  .topbar-actions,
  .nav-list {
    width: 100%;
  }

  .nav-list button,
  .nav-button,
  .primary-button {
    width: 100%;
  }

  .column-browser {
    grid-auto-flow: row;
    grid-auto-columns: auto;
  }
}
