:root {
  color-scheme: dark;
  --ink: #f6f1e8;
  --muted: #a9a094;
  --line: #2a2724;
  --paper: #080808;
  --panel: #11100f;
  --panel-2: #171513;
  --accent: #d8b56d;
  --accent-dark: #b99148;
  --warn: #ff806b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(216, 181, 109, 0.16), transparent 34%),
    var(--paper);
}

button,
input {
  font: inherit;
}

.auth-shell,
.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-panel,
.service-panel,
.chat-panel,
.gallery-section {
  background: rgba(17, 16, 15, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.36);
}

.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
}

.center-brand {
  display: flex;
  justify-content: center;
  text-align: center;
}

.brand-logo {
  width: min(220px, 72vw);
  max-height: 92px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
}

.brand-wordmark {
  color: #fff;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0;
}

.brand-wordmark span {
  color: var(--accent);
}

.auth-panel .center-brand {
  margin-bottom: 28px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.02;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.login-form,
.upload-box {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid #34302b;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #0c0c0b;
  outline: none;
}

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

button,
.logout {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

button {
  color: #111;
  background: var(--accent);
}

button:hover {
  background: var(--accent-dark);
}

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

.logout {
  color: var(--ink);
  background: #1f1c19;
  border: 1px solid var(--line);
}

.alert,
.status.error {
  color: var(--warn);
  background: rgba(255, 128, 107, 0.1);
  border: 1px solid rgba(255, 128, 107, 0.38);
}

.alert,
.status {
  border-radius: 8px;
  padding: 12px 14px;
}

.app-shell {
  padding: 28px 0 44px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar .logout:last-child {
  justify-self: end;
}

.barber-meta {
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.barber-meta span {
  font-weight: 850;
}

.barber-meta small {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}

.service-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.service-option {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.service-option:hover,
.service-option.active {
  color: #111;
  background: var(--accent);
  border-color: var(--accent);
}

.chat-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.message {
  display: grid;
  gap: 6px;
  max-width: 760px;
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.45;
}

.message.assistant {
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.message span,
.message small {
  color: var(--muted);
}

.upload-box {
  max-width: 760px;
}

.file-picker input {
  padding: 10px;
}

.status {
  max-width: 760px;
  color: var(--muted);
  background: #151412;
  border: 1px solid var(--line);
}

.chat-history {
  display: grid;
  gap: 16px;
}

.chat-result {
  display: grid;
  gap: 10px;
}

.chat-result img,
.gallery-card img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.chat-result a {
  width: min(760px, 100%);
}

.gallery-section {
  margin-top: 18px;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.admin-tabs a {
  color: var(--ink);
  background: #1f1c19;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.admin-tabs a.active {
  color: #111;
  background: var(--accent);
  border-color: var(--accent);
}

.admin-form,
.barber-edit-form {
  display: grid;
  gap: 12px;
}

.admin-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  margin-bottom: 18px;
}

.barber-list {
  display: grid;
  gap: 12px;
}

.barber-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #0d0d0c;
}

.barber-edit-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  align-items: end;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
}

.checkbox-label input {
  width: auto;
}

.gallery-card,
.stat-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d0c;
}

.gallery-card div,
.stat-card {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.gallery-card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.gallery-card span,
.gallery-card small,
.stat-card small {
  color: var(--muted);
}

.stat-card span {
  color: var(--accent);
  font-size: 42px;
  font-weight: 900;
}

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

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .topbar .logout:last-child {
    justify-self: center;
  }

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

  .service-panel {
    grid-template-columns: 1fr 1fr;
  }

  .gallery-grid,
  .stats-grid,
  .admin-form,
  .barber-edit-form {
    grid-template-columns: 1fr;
  }
}
