* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --primary: #ca402b;
  --primary-hover: #a8341f;
  --header-bg: #1d1c1a;
  --text: #1d1c1a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

/* Header */

header {
  background: var(--header-bg);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 8px;
}

header h1 {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}

nav a:hover { color: #fff; background: rgba(255,255,255,0.1); }
nav a.nav-user { color: rgba(255,255,255,0.5); cursor: default; }
nav a.nav-user:hover { background: none; }
nav a.nav-logout { color: rgba(255,255,255,0.5); }
nav a.nav-logout:hover { color: #fff; }

/* Layout */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Login */

.login-prompt {
  text-align: center;
  padding: 80px 20px;
}

.login-prompt p {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1.1rem;
}

/* Breadcrumbs */

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumbs .sep {
  color: var(--border);
  user-select: none;
}

.breadcrumbs .current {
  color: var(--text);
  font-weight: 600;
}

/* Typography */

h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

h3 { font-size: 1rem; }

.page-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.section-label {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: 28px;
}

/* Buttons */

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
  padding: 10px 18px;
}

.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: none;
  color: var(--error);
  border: 2px solid var(--error);
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-danger:hover { background: #fef2f2; }

.btn-small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

/* Cards */

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.card-clickable {
  cursor: pointer;
  transition: border-color 0.15s;
}

.card-clickable:hover {
  border-color: var(--primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card-header h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-ready { background: #f0fdf4; color: var(--success); }
.badge-pending { background: #fffbeb; color: var(--warning); }
.badge-error { background: #fef2f2; color: var(--error); }
.badge-neutral { background: var(--bg); color: var(--text-muted); }

/* Meta text */

.meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Forms */

form { margin-bottom: 20px; }

.form-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.form-card h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  margin-bottom: 12px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.input-with-suffix {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.input-with-suffix input {
  margin-bottom: 0;
  flex: 1;
}

.input-suffix {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
  padding-bottom: 2px;
}

/* User list */

.user-list {
  list-style: none;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.user-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.user-list li:last-child {
  border-bottom: none;
}

.user-list .user-sub {
  font-size: 0.95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 32px 16px;
  font-size: 0.9rem;
}

/* Alerts */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 2px solid transparent;
  animation: fadeIn 0.2s ease;
}

.alert-error { background: #fef2f2; color: var(--error); border-color: var(--error); }
.alert-success { background: #f0fdf4; color: var(--success); border-color: var(--success); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Documentation */

.doc {
  line-height: 1.7;
}

.doc h3 {
  margin-top: 24px;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.doc p {
  margin-bottom: 12px;
}

.doc code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
  font-size: 0.9rem;
}

.doc th, .doc td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.doc th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.doc .example {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0 20px;
}

.doc .example p {
  margin-bottom: 4px;
}

.help-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

.help-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
