:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-2: #0f1318;
  --fg: #e7ecf3;
  --mut: #8a96a8;
  --accent: #4fd1c5;
  --accent-hover: #5fe0d4;
  --danger: #ef5350;
  --card: #13171c;
  --card-hover: #171c22;
  --border: #1f262f;
  --input-bg: #0a0d11;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 20% 10%, #12222a 0%, var(--bg) 60%);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  max-width: 420px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}

.card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.brand-dot,
.brand .dot,
.brand-back .dot,
.card h1 .dot {
  display: inline-block;
  width: 0.22em;
  height: 0.22em;
  border-radius: 50%;
  background: var(--accent);
  color: transparent;
  vertical-align: middle;
  margin: 0 0.02em;
  font-size: 1em;
  position: relative;
  top: -0.06em;
}
.card .sub { color: var(--mut); margin: 0 0 24px; font-size: 14px; }

form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  color: var(--mut);
  font-size: 13px;
  font-weight: 500;
}

.field input[type="text"],
.field input[type="password"] {
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s;
}

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

button.primary {
  margin-top: 8px;
  background: var(--accent);
  color: #07201e;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

.error {
  margin: 0;
  color: var(--danger);
  background: rgba(239, 83, 80, 0.08);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.error[hidden] { display: none; }

.app-shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 34px;
  height: 34px;
  vertical-align: middle;
  margin-right: 6px;
  margin-top: -2px;
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.auth-logo img {
  width: 72px;
  height: 72px;
  display: block;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.brand-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand-back > span { white-space: nowrap; }
.brand-back:hover { background: var(--card); }
.brand-back .icon-back {
  color: var(--mut);
  transition: color .15s;
  flex-shrink: 0;
}
.brand-back:hover .icon-back { color: var(--accent); }
.brand-back .brand-mark {
  width: 26px;
  height: 26px;
  margin: -2px 0;
  flex-shrink: 0;
}

.sep {
  color: var(--mut);
  opacity: 0.4;
  user-select: none;
}

.switcher {
  position: relative;
}

.switcher-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, color .15s;
}
.switcher-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.switcher-btn:disabled {
  cursor: default;
  opacity: 0.8;
}
.switcher-btn:disabled .icon-chevron { display: none; }
.switcher-btn .icon-chevron {
  transition: transform .15s;
  opacity: 0.7;
}
.switcher-btn[aria-expanded="true"] .icon-chevron {
  transform: rotate(180deg);
}

.switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  z-index: 20;
}

.switcher-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  transition: background .12s;
}
.switcher-menu a:hover { background: var(--bg-2); }
.switcher-menu a.current { color: var(--accent); }
.switcher-menu a .check { color: var(--accent); font-size: 12px; }
.switcher-menu .divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}
.switcher-menu .section-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mut);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip .name { color: var(--fg); font-weight: 500; font-size: 14px; }
.user-chip .role {
  color: var(--mut);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

button.ghost {
  background: transparent;
  color: var(--mut);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
button.ghost:hover { color: var(--fg); border-color: var(--accent); }

main.app-main {
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
main.app-main.wide {
  max-width: min(1800px, 100%);
  padding: 24px 32px;
}

footer {
  margin-top: 24px;
  color: var(--mut);
  font-size: 12px;
  text-align: center;
}

/* Hub — tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.tile {
  display: block;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--fg);
  transition: background .15s, border-color .15s, transform .15s;
  cursor: pointer;
}

.tile:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.tile.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tile.disabled:hover { background: var(--card); border-color: var(--border); transform: none; }

.tile h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.tile p {
  margin: 0;
  color: var(--mut);
  font-size: 13px;
  line-height: 1.5;
}

.tile .badge {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  background: rgba(79, 209, 197, 0.12);
  border: 1px solid rgba(79, 209, 197, 0.3);
  color: var(--accent);
  font-size: 11px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tile.disabled .badge {
  background: rgba(138, 150, 168, 0.08);
  border-color: rgba(138, 150, 168, 0.2);
  color: var(--mut);
}

.empty-state {
  margin-top: 40px;
  padding: 32px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  color: var(--mut);
}
