/* ===========================================================
   Nevercode — shared brand styles
   Used by: index.html, welcome.html,
            applications.html, settings.html
   =========================================================== */

:root {
  /* Brand palette */
  --navy: #000626;            /* logo color — primary text & brand */
  --navy-80: #0a1140;         /* slightly lighter for hover/active */
  --navy-10: rgba(0, 6, 38, 0.08);
  --navy-05: rgba(0, 6, 38, 0.04);

  --bg: #fafaf7;              /* warm off-white page background */
  --surface: #ffffff;         /* cards, modals */
  --surface-elevated: #ffffff;

  --accent: #d97757;          /* muted orange */
  --accent-hover: #c7624a;
  --accent-soft: rgba(217, 119, 87, 0.1);

  --text: #000626;
  --text-dim: #5a5f72;
  --text-dimmer: #8a8ea0;
  --text-on-navy: #fafaf7;

  --border: rgba(0, 6, 38, 0.12);
  --border-strong: rgba(0, 6, 38, 0.22);

  --success: #0a7c42;
  --success-soft: rgba(10, 124, 66, 0.08);

  /* Typography */
  --font-sans: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* Layout */
  --max-width: 1200px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
}

/* Fonts */
@import url("https://api.fontshare.com/v2/css?f[]=general-sans@400,500,600,700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap");

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  letter-spacing: -0.005em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography scale */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: clamp(2.25rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 2.2vw, 1.875rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-weight: 500; }

p { color: var(--text); }

code, pre, .mono { font-family: var(--font-mono); }

a {
  color: var(--text);
  text-decoration: none;
  transition: color 150ms ease;
}
a:hover { color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
}

/* =========================================================
   Top bar
   ========================================================= */
.topbar {
  width: 100%;
  padding: 1.5rem clamp(1.5rem, 4vw, 3rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid transparent;
  background: var(--bg);
}
.topbar .brand {
  display: flex;
  align-items: center;
}
.topbar .brand img {
  height: 28px;
  width: auto;
  display: block;
}
/* Larger variant — used on the landing page where the logo is the anchor */
.topbar.topbar-large .brand img {
  height: 40px;
}
.topbar .top-right {
  font-size: 0.9rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar .top-right a {
  color: var(--text-dim);
}
.topbar .top-right a:hover {
  color: var(--accent);
}

/* User chip (shown on welcome screen) */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
}
.user-chip .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--text-on-navy);
  display: grid;
  place-items: center;
  font-weight: 500;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-chip .caret {
  color: var(--text-dimmer);
  font-size: 0.7rem;
}

/* =========================================================
   Page shell / layout
   ========================================================= */
.page {
  flex: 1;
  width: 100%;
}
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.footer {
  padding: 2rem clamp(1.5rem, 4vw, 3rem);
  color: var(--text-dimmer);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.footer .tagline {
  letter-spacing: 0.02em;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 150ms ease;
  cursor: pointer;
  width: 100%;
  line-height: 1;
}

.btn-primary {
  background: var(--navy);
  color: var(--text-on-navy);
}
.btn-primary:hover {
  background: var(--navy-80);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--navy);
  background: var(--navy-05);
}

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

.btn .coming-soon {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--navy-10);
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-left: auto;
}

.btn .icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn .icon svg { width: 100%; height: 100%; display: block; }
.btn .arrow { margin-left: auto; opacity: 0.8; transition: transform 150ms ease; }
.btn-primary:hover .arrow { transform: translateX(2px); }

/* Divider with "or" */
.or-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1rem 0;
  color: var(--text-dimmer);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* =========================================================
   Form fields (used on signup modal)
   ========================================================= */
.field {
  margin-bottom: 1.1rem;
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0, 6, 38, 0.08);
}
.field input.invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint {
  font-size: 0.78rem;
  color: var(--text-dimmer);
  margin-top: 0.4rem;
}
.field .error {
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 0.4rem;
  display: none;
}
.field.has-error .error { display: block; }
.field.has-error .hint { display: none; }

/* =========================================================
   Modal (used on signup page)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 6, 38, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  animation: fadeIn 200ms ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 2rem;
  box-shadow: 0 20px 50px -10px rgba(0, 6, 38, 0.3);
  position: relative;
  animation: slideUp 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal .close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-dimmer);
  font-size: 1.2rem;
  transition: background 150ms ease;
}
.modal .close:hover {
  background: var(--navy-05);
  color: var(--text);
}
.modal h2 {
  margin-bottom: 0.4rem;
}
.modal .subhead {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}
.modal .back-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.modal .back-link:hover {
  color: var(--accent);
}
.modal .divider-thin {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0 0;
}

/* =========================================================
   Dashboard layout — sidebar + main content
   Used by: applications.html, settings.html
   ========================================================= */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 0px);
  flex: 1;
  width: 100%;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 1.75rem 1rem;
  background: var(--surface);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  padding: 0 0.75rem 1.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.sidebar .brand img {
  height: 28px;
  width: auto;
  display: block;
}
.sidebar-nav {
  display: grid;
  gap: 0.15rem;
}
.sidebar-nav a,
.sidebar-nav .disabled-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}
.sidebar-nav a:hover {
  background: var(--navy-05);
  color: var(--text);
}
.sidebar-nav a.active {
  background: var(--navy);
  color: var(--text-on-navy);
}
.sidebar-nav a.active:hover {
  background: var(--navy);
}
.sidebar-nav .disabled-item {
  cursor: not-allowed;
  opacity: 0.4;
}
.sidebar-nav .nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-nav .nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.sidebar-user .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--text-on-navy);
  display: grid;
  place-items: center;
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
}

/* Main content area */
.app-main {
  padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem);
  max-width: 1100px;
  width: 100%;
}
.app-main .page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}
.app-main .page-header h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.app-main .page-header .page-subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Pill buttons (for page header actions) */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}
.btn-pill:hover {
  border-color: var(--navy);
  background: var(--navy-05);
}
.btn-pill.btn-pill-primary {
  background: var(--navy);
  color: var(--text-on-navy);
  border-color: var(--navy);
}
.btn-pill.btn-pill-primary:hover {
  background: var(--navy-80);
}
.btn-pill.btn-pill-danger {
  border-color: rgba(200, 40, 50, 0.4);
  color: #c82832;
  background: var(--surface);
}
.btn-pill.btn-pill-danger:hover {
  border-color: #c82832;
  background: rgba(200, 40, 50, 0.06);
}

/* App card */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.app-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(0,6,38,0.04), 0 4px 12px rgba(0,6,38,0.04);
}
.app-card .app-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.app-card .app-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: var(--text-on-navy);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.app-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.app-card .app-repo {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-dim);
  word-break: break-all;
}
.app-card .app-repo a {
  color: var(--text-dim);
  text-decoration: none;
}
.app-card .app-repo a:hover {
  color: var(--accent);
}
.app-card .app-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Meta row: ID, last build, etc. */
.app-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}
.app-meta .meta-cell {
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  min-width: 0;
}
.app-meta .meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dimmer);
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.app-meta .meta-value {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-meta .meta-value.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.app-meta .meta-value .dim {
  color: var(--text-dim);
  font-weight: 400;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 2px 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.status-pill.success {
  background: var(--success-soft);
  color: var(--success);
}
.status-pill.success::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.status-pill.pending {
  background: var(--navy-05);
  color: var(--text-dim);
}
.status-pill.pending::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dimmer);
}

/* Empty state */
.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  background: var(--surface);
}
.empty-state h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.empty-state p {
  color: var(--text-dim);
  max-width: 42ch;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* Settings sections */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
}
.settings-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.settings-section .section-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.settings-row:first-of-type {
  border-top: none;
  padding-top: 0;
}
.settings-row .row-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.settings-row .row-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
}
.settings-row .row-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
  line-height: 1.45;
}

/* Confirm dialog */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 6, 38, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.confirm-dialog.open { display: flex; }
.confirm-dialog .confirm-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px -10px rgba(0, 6, 38, 0.3);
}
.confirm-dialog h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.confirm-dialog p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}
.confirm-dialog .confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Toast — shared across pages */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--navy);
  color: var(--text-on-navy);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 6, 38, 0.25);
  opacity: 0;
  transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 250ms ease;
  pointer-events: none;
  z-index: 200;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.toast .check {
  color: var(--accent);
  margin-right: 0.4rem;
}
