.auth-page,
.admin-page {
  min-height: 100vh;
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #0f1419;
  color: #e2e8f0;
}

.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem;
  background: #1a2332;
  border: 1px solid #334155;
  border-radius: 12px;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.auth-sub {
  margin: 0 0 1.25rem;
  color: #94a3b8;
  font-size: 0.9rem;
}

.auth-error {
  padding: 0.5rem 0.65rem;
  margin-bottom: 1rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  border-radius: 6px;
  color: #fca5a5;
  font-size: 0.85rem;
}

.auth-google {
  display: block;
  text-align: center;
  padding: 0.65rem 1rem;
  background: #fff;
  color: #1e293b;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}

.auth-divider {
  margin: 1.25rem 0;
  text-align: center;
  color: #64748b;
  font-size: 0.8rem;
}

.auth-divider span {
  background: #1a2332;
  padding: 0 0.5rem;
}

.auth-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: #94a3b8;
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #0f1419;
  color: #e2e8f0;
  box-sizing: border-box;
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.auth-actions--single .auth-btn {
  flex: none;
  width: 100%;
}

.auth-notice {
  padding: 0.5rem 0.65rem;
  margin-bottom: 1rem;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid #22c55e;
  border-radius: 6px;
  color: #86efac;
  font-size: 0.85rem;
}

.auth-resend {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.85rem;
}

.auth-link-btn {
  border: none;
  background: none;
  color: #38bdf8;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.auth-card--wide {
  max-width: 480px;
}

.auth-optional-label {
  color: #64748b;
  font-weight: normal;
}

.profile-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 480px;
  margin: 2rem auto 0;
  padding: 0 1rem;
}

.profile-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.profile-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.profile-nav a {
  color: #38bdf8;
  text-decoration: none;
  font-size: 0.85rem;
}

.admin-user-name--pending {
  color: #94a3b8;
}


.auth-btn {
  flex: 1;
  padding: 0.55rem;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #334155;
  color: #e2e8f0;
  cursor: pointer;
}

.auth-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
}

.auth-footer {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  text-align: center;
}

.auth-footer a {
  color: #38bdf8;
}

/* Header auth widget (index.html) */
.auth-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 0.78rem;
}

.auth-header-link {
  color: #38bdf8;
  text-decoration: none;
}

.auth-header-link--admin {
  color: #fbbf24;
}

.auth-header-user {
  color: #94a3b8;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.auth-header-user:hover {
  color: #38bdf8;
}

.auth-header-logout {
  padding: 0.2rem 0.45rem;
  border: 1px solid #475569;
  border-radius: 4px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.75rem;
}

header .toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Admin */
.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #334155;
}

.admin-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.admin-nav a {
  color: #38bdf8;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

.admin-panel {
  background: #1a2332;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 1rem;
}

.admin-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.admin-hint {
  color: #94a3b8;
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

.admin-status {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: #4ade80;
}

.admin-status--err {
  color: #f87171;
}

.admin-empty {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
}

.admin-users-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 70vh;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.65rem;
  padding: 0.1rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.admin-user-row.is-selected {
  background: rgba(56, 189, 248, 0.1);
}

.admin-user-select {
  flex: 1;
  min-width: 0;
  padding: 0.15rem 0.35rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.admin-user-name {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-name--active {
  color: #4ade80;
}

.admin-user-name--admin {
  color: #fb923c;
}

.admin-user-name--revoked {
  color: #64748b;
  text-decoration: line-through;
}

.admin-user-dismiss {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.admin-user-row:hover .admin-user-dismiss {
  opacity: 1;
}

.admin-user-dismiss:hover {
  color: #f87171;
}

.admin-user-dismiss--restore {
  font-size: 0.82rem;
}

.admin-user-dismiss--restore:hover {
  color: #4ade80;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th,
.admin-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #334155;
  text-align: left;
  vertical-align: top;
}

.admin-table--files code {
  font-size: 0.75rem;
  color: #94a3b8;
}

.admin-ok { color: #4ade80; }
.admin-bad { color: #f87171; }

.admin-btn {
  padding: 0.3rem 0.55rem;
  border: 1px solid #475569;
  border-radius: 4px;
  background: #334155;
  color: #e2e8f0;
  cursor: pointer;
  font-size: 0.78rem;
}

.admin-btn--small {
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
}

.admin-btn--danger {
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.45);
  color: #fca5a5;
}

.admin-file-link {
  background: none;
  border: none;
  color: #38bdf8;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
}

.admin-file-path {
  font-family: monospace;
  font-size: 0.78rem;
  color: #94a3b8;
  margin: 0.75rem 0 0.35rem;
}

.admin-file-preview {
  max-height: 320px;
  overflow: auto;
  padding: 0.75rem;
  background: #0f1419;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: pre-wrap;
  margin: 0;
}

.admin-denied {
  padding: 2rem;
  text-align: center;
}

/* C IDE cloud save */
.btn-cide-cloud {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-cide-cloud--saved {
  border-color: #22c55e !important;
  color: #4ade80 !important;
}

.btn-cide-cloud-icon {
  font-size: 0.95rem;
}

/* Cloud file browser / save-as */
.cloud-files-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
}

.cloud-files-overlay[hidden] {
  display: none !important;
}

.cloud-files-dialog {
  width: min(440px, 100%);
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem;
  background: #1a2332;
  border: 1px solid #334155;
  border-radius: 12px;
  color: #e2e8f0;
}

.cloud-files-title {
  margin: 0;
  font-size: 1.05rem;
}

.cloud-files-message {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85rem;
}

.cloud-files-field span {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.cloud-files-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.55rem;
  border: 1px solid #475569;
  border-radius: 6px;
  background: #0f1419;
  color: #e2e8f0;
}

.cloud-files-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  max-height: 280px;
  border: 1px solid #334155;
  border-radius: 8px;
}

.cloud-files-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-bottom: 1px solid #334155;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
}

.cloud-files-item:last-child {
  border-bottom: none;
}

.cloud-files-item.is-selected,
.cloud-files-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.cloud-files-item-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.cloud-files-item-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.cloud-files-empty {
  margin: 0;
  color: #64748b;
  font-size: 0.85rem;
}

.cloud-files-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.cloud-files-btn {
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #334155;
  color: #e2e8f0;
  cursor: pointer;
}

.cloud-files-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
}

.cloud-files-btn--muted {
  background: transparent;
}

.cloud-files-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
