:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --panel: #1f2937;
  --panel-soft: #273449;
  --border: #334155;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-soft: #cbd5e1;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --success: #34d399;
  --shadow: rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --radius-sm: 10px;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 32rem),
    linear-gradient(180deg, #0f172a 0%, #111827 100%);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-link {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.2rem 0.55rem;
  color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-nav a {
  color: var(--text-soft);
  font-weight: 600;
}

.app-nav a:hover {
  color: var(--primary);
}

.session-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.session-user {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.logout-form {
  margin: 0;
}

.link-button {
  padding: 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}

.link-button:hover {
  color: var(--primary-hover);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.app-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(51, 65, 85, 0.7);
  font-size: 0.88rem;
}

.panel,
.auth-card {
  background: rgba(31, 41, 55, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px var(--shadow);
}

.panel {
  padding: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel-header h1,
.auth-card h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.muted {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 180px);
}

.auth-card {
  width: min(440px, 100%);
  padding: 2rem;
}

.auth-card__header {
  margin-bottom: 1.5rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.45rem;
}

.form-field label {
  color: var(--text-soft);
  font-weight: 700;
}

.form-field input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  color: var(--text);
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.form-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.65rem 0.95rem;
  color: #082f49;
  background: var(--primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.button-primary {
  width: 100%;
}

.button-secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.button-secondary:hover {
  color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.45);
}

.alert {
  padding: 0.8rem 0.95rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.alert-error {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.resource-card,
.resource-row {
  background: rgba(39, 52, 73, 0.78);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.resource-card {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.resource-card h2,
.resource-row h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  word-break: break-word;
}

.table-list {
  display: grid;
  gap: 0.75rem;
}

.empty-state {
  padding: 2rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.42);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 0.4rem;
  color: var(--text);
}

.empty-state p {
  margin: 0;
}

.metadata-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.metadata-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.25rem 0.65rem;
  color: var(--text-soft);
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.36);
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.75);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  color: var(--text-soft);
  background: #172033;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table td {
  color: var(--text);
  max-width: 360px;
  word-break: break-word;
  font-size: 0.92rem;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 1rem;
  }

  .session-box {
    width: 100%;
    justify-content: space-between;
  }

  .panel-header,
  .resource-row {
    flex-direction: column;
    align-items: stretch;
  }

  .panel,
  .auth-card {
    padding: 1rem;
  }

  .button {
    width: 100%;
  }
}