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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

/* Top Organic Framing Ribbon (strictly zero text overlaps it) */
.top-organic-band {
  width: 100%;
  height: 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.top-organic-band svg {
  width: 100%;
  height: 22px;
  display: block;
}

/* Shared App Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
}

.header-inner {
  max-width: 1520px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.btn:hover {
  background: var(--surface-col);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--accent-1);
  color: var(--accent-1-ink);
  border-color: var(--accent-1);
}

.btn-primary:hover {
  background: var(--accent-1);
  border-color: var(--accent-1);
  opacity: 0.92;
}

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--accent-1);
  padding: 0 8px;
}

.btn-link:hover {
  background: var(--accent-1-tint);
  color: var(--accent-1-tint-ink);
  border-color: transparent;
}

/* Login Page (Concept A: quiet surface with dedicated bottom organic framing) */
.auth-page {
  min-height: calc(100vh - 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 36px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.auth-body {
  padding: 28px 24px 22px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.auth-subtitle {
  margin: 0 0 22px;
  font-size: 13.5px;
  color: var(--muted);
}

.auth-errors {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-2-tint);
  color: var(--accent-2-tint-ink);
  font-size: 13.5px;
  font-weight: 600;
}

.field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.field-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  transition: border-color 140ms ease, background 140ms ease;
}

.field-input:focus {
  border-color: var(--accent-1);
  background: var(--surface);
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
}

.auth-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* Dedicated organic SVG frame strictly below login text */
.auth-organic-foot {
  height: 62px;
  background: var(--surface-col);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}

.auth-organic-foot svg {
  width: 100%;
  height: 54px;
  display: block;
}

@media (max-width: 480px) {
  .app-header {
    padding: 12px 14px;
  }

  .brand-title {
    font-size: 18px;
  }

  .auth-body {
    padding: 22px 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
