:root {
  --blue: #183a68;
  --blue-700: #102b50;
  --orange: #e56820;
  --green: #1f8a5b;
  --yellow: #b7791f;
  --red: #b42318;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #edf2f7;
  --text: #182033;
  --muted: #667085;
  --border: #d9e1ea;
  --shadow: 0 18px 42px rgba(16, 43, 80, 0.12);
  font-family: Roboto, Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-width: 320px;
}

a {
  color: inherit;
}

body.auth-loading .app-shell,
body.auth-denied .app-shell {
  display: none;
}

body.auth-ready .access-gate {
  display: none;
}

.access-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.access-panel {
  width: min(100%, 430px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.access-brand {
  margin-bottom: 24px;
  color: var(--blue-700);
}

.access-brand span {
  color: var(--muted);
}

.access-panel h1 {
  margin: 0;
  color: var(--blue-700);
  font-size: 26px;
  line-height: 1.2;
}

.access-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 20px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--orange);
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.login-button:hover {
  background: #c85015;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--blue);
  color: #ffffff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--orange);
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.2;
}

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-item.disabled {
  opacity: 0.52;
  cursor: default;
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 15px;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  color: var(--blue-700);
  font-size: 30px;
  line-height: 1.15;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.docs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--orange);
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue-700);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.secondary-button:hover {
  border-color: var(--orange);
}

.danger-button {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--red);
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

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

.status-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 116px;
  padding: 18px;
}

.status-card h2,
.panel h2 {
  margin: 0;
  color: var(--blue-700);
  font-size: 16px;
  line-height: 1.3;
}

.status-card p,
.panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.status-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--yellow);
}

.status-dot.online {
  background: var(--green);
}

.status-dot.offline {
  background: var(--red);
}

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

.users-section {
  margin-bottom: 18px;
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.user-summary div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.user-summary span {
  display: block;
  color: var(--blue-700);
  font-size: 22px;
  line-height: 1.1;
}

.feedback {
  min-height: 22px;
}

.feedback[data-state="ok"] {
  color: var(--green);
}

.feedback[data-state="error"] {
  color: var(--red);
}

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

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
  font-size: 13px;
}

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

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

.users-table td strong,
.users-table td span {
  display: block;
}

.users-table td span {
  margin-top: 3px;
  color: var(--muted);
}

.role-select {
  min-height: 34px;
  min-width: 118px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.status-label {
  font-weight: 800;
}

.status-pending {
  color: var(--yellow);
}

.status-active {
  color: var(--green);
}

.status-blocked {
  color: var(--red);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.timeline {
  display: grid;
  gap: 0;
  padding-top: 8px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
}

.timeline-row > span {
  position: relative;
  width: 13px;
  height: 13px;
  margin-top: 3px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
}

.timeline-row.done > span {
  border-color: var(--green);
  background: var(--green);
}

.timeline-row strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.side-panel {
  align-self: start;
}

.side-panel a {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--blue-700);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.side-panel a:hover {
  border-color: var(--orange);
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 18px;
  }

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

  .status-grid,
  .user-summary,
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .main {
    padding: 20px 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .docs-button {
    width: 100%;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }
}
