@font-face {
  font-family: "Code";
  src: url("fonts/oco.otf");
}

@font-face {
  font-family: "YoungSerifBold";
  src: url("fonts/ysrf.ttf");
}

:root {
  /* Core colors from Good Enough */
  --background: #f1ece4;
  --detail: #605a52;
  --highlight: #6a4cff;
  --light-background: #fbfaf8;

  /* Extended palette */
  --surface-muted: #ddd7c5;
  --surface-alt: #ebe7db;
  --surface-border: #d0cbb8;
  --border: #d0cbb8;
  --text-muted: rgba(96, 90, 82, 0.7);

  /* Semantic colors */
  --primary-dark: #1a1a1a;
  --primary-light: #f4f1e8;
  --success: #2d5016;
  --warning: #8b7355;
  --danger: #8b4513;
  --error: #d62828;
}

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

/* Base styles */
body {
  margin: 0;
  background-color: var(--background);
  color: var(--detail);
  font-family: "Code", serif;
  line-height: 1.6;
}

/* Centered page layout for landing, login, signup */
.centered-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  gap: 2rem;
}

.centered-wrapper {
  justify-content: center;
  text-align: center;
}

h1,
h2,
h3 {
  font-family: "YoungSerifBold", serif;
  font-weight: normal;
  color: var(--detail);
}

h1 {
  text-align: center;
  font-size: 2.5rem;
}

p {
  font-family: "Code", serif;
  color: var(--detail);
}

a {
  color: var(--detail);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* The signature dot */
.dot {
  color: var(--highlight);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ===========================================
   BUTTONS
   =========================================== */

button {
  color: var(--detail);
  background: var(--light-background);
  padding: 6px 12px;
  border: 1px solid var(--detail);
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

button:hover {
  opacity: 0.8;
}

button.primary,
.btn-primary {
  background: var(--primary-dark);
  color: var(--primary-light);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

button.primary:hover,
.btn-primary:hover {
  opacity: 0.8;
}

button.secondary,
.btn-secondary {
  background: var(--surface-muted);
  color: var(--detail);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: "Code", serif;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

button.secondary:hover,
.btn-secondary:hover {
  opacity: 0.8;
}

button.danger,
.btn-danger {
  background: var(--danger);
  color: var(--primary-light);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: "Code", serif;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

button.danger:hover,
.btn-danger:hover {
  opacity: 0.8;
}

/* ===========================================
   FORMS
   =========================================== */

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.form-container {
  max-width: 400px;
  background: var(--light-background);
  padding: 2rem;
}

label {
  font-family: "Code", serif;
  color: var(--detail);
  font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  background: var(--background);
  border: none;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--detail);
}

input::placeholder,
textarea::placeholder {
  opacity: 0.5;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border: 2px solid var(--highlight);
}

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

select {
  cursor: pointer;
}

input[type="submit"],
form button {
  font-family: "YoungSerifBold";
  font-size: 16px;
  color: var(--detail);
  background: var(--light-background);
  padding: 12px 24px;
  border: 1px solid var(--detail);
  cursor: pointer;
}

input[type="submit"]:hover,
form button:hover {
  background: var(--background);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
}

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

.hint {
  font-size: 0.85rem;
  opacity: 0.6;
  margin-top: 0.5rem;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  align-items: start;
  gap: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  cursor: pointer;
}

.checkbox-content {
  flex: 1;
}

.checkbox-title {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.checkbox-desc {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Radio group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--surface-muted);
  cursor: pointer;
  transition: background 0.2s ease;
}

.radio-option:hover {
  background: var(--border);
}

.radio-option input[type="radio"] {
  width: auto;
  margin-top: 0.25rem;
}

.radio-option-content {
  flex: 1;
}

.radio-option-title {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.radio-option-desc {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ===========================================
   TABS
   =========================================== */

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.tab {
  background: var(--surface-muted);
  color: var(--detail);
  border: none;
  padding: 0.75rem 2rem;
  font-family: "Code", serif;
  font-size: 1rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    opacity 0.2s ease;
  opacity: 0.6;
}

.tab.active {
  background: var(--light-background);
  opacity: 1;
}

.tab:hover {
  opacity: 1;
}

.tab-content {
  display: none;
  background: var(--light-background);
  padding: 2rem;
}

.tab-content.active {
  display: block;
}

/* ===========================================
   TABLES
   =========================================== */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-family: "Code", serif;
  margin-bottom: 1rem;
}

.data-table thead {
  background: var(--surface-muted);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: normal;
}

.data-table th.sortable {
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.data-table th.sortable:hover {
  background: var(--border);
}

.data-table th.sortable::after {
  content: " \2195";
  opacity: 0.3;
  font-size: 0.8rem;
}

.data-table tbody tr {
  transition: background 0.1s ease;
}

.data-table tbody tr:nth-child(odd) {
  background: var(--surface-alt);
}

.data-table tbody tr:nth-child(even) {
  background: var(--light-background);
}

.data-table tbody tr:hover {
  background: var(--surface-muted);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

/* ===========================================
   BADGES
   =========================================== */

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-family: "Code", serif;
  background: var(--primary-dark);
  color: var(--primary-light);
}

.badge-success,
.badge.active,
.badge.complete {
  background: var(--success);
}

.badge-warning,
.badge.pending,
.badge.draft {
  background: var(--warning);
}

.badge-danger,
.badge.failed {
  background: var(--danger);
}

.badge.current {
  background: var(--success);
}

.badge.suppressed {
  background: var(--warning);
}

/* ===========================================
   TAGS
   =========================================== */

.tag {
  display: inline-block;
  background: var(--primary-dark);
  color: var(--primary-light);
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

.tag-input {
  background: var(--surface-muted);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 40px;
}

.tag-input .tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

.tag-input .tag button {
  background: none;
  border: none;
  color: var(--primary-light);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
}

/* ===========================================
   CARDS
   =========================================== */

.card {
  background: var(--light-background);
  padding: 1.5rem;
  margin-bottom: 1rem;
  text-decoration: none;
  color: var(--detail);
  display: block;
  transition: background 0.2s ease;
}

.card:hover {
  background: var(--surface-muted);
}

.card-muted {
  background: var(--surface-muted);
  padding: 1.5rem;
}

.card-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  font-family: "YoungSerifBold", serif;
}

.card-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
  font-family: "Code", serif;
}

.card-description {
  font-size: 0.9rem;
  opacity: 0.8;
  font-family: "Code", serif;
}

/* ===========================================
   STATS
   =========================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--surface-muted);
  padding: 1rem;
}

.stat-card {
  background: var(--surface-muted);
  padding: 1.5rem;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
}

.stat-change {
  font-size: 0.85rem;
  opacity: 0.6;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* ===========================================
   INFO & WARNING BOXES
   =========================================== */

.info-box {
  background: var(--surface-muted);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-family: "Code", serif;
}

.info-box h3 {
  font-size: 1rem;
  font-weight: normal;
  margin-bottom: 0.5rem;
}

.info-box ul {
  list-style: none;
  margin-top: 0.5rem;
}

.info-box li {
  padding: 0.25rem 0;
}

.info-box li::before {
  content: "\2192 ";
  opacity: 0.5;
}

.warning-box {
  background: var(--warning);
  color: var(--primary-light);
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-family: "Code", serif;
}

.error-message {
  font-family: "Code", serif;
  color: var(--error);
  background: #fef2f2;
  padding: 12px;
  border: 1px solid var(--error);
  border-radius: 2px;
  text-align: center;
  font-size: 14px;
  display: none;
}

/* ===========================================
   SECTIONS
   =========================================== */

.section-header {
  font-size: 1.5rem;
  font-weight: normal;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-family: "YoungSerifBold", serif;
}

.content-section {
  background: var(--light-background);
  padding: 2rem;
  margin-bottom: 2rem;
}

.form-section {
  margin-bottom: 2rem;
}

.form-section h2 {
  font-size: 1.3rem;
  font-weight: normal;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ===========================================
   NAVIGATION
   =========================================== */

nav {
  margin-bottom: 2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--detail);
  text-decoration: none;
  font-family: "Code", serif;
  transition: opacity 0.2s ease;
}

.nav-links a:hover {
  opacity: 0.6;
}

.breadcrumb {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
  font-family: "Code", serif;
}

.breadcrumb a {
  color: var(--detail);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===========================================
   HEADER & FOOTER
   =========================================== */

header {
  background: transparent;
  border-bottom: none;
  padding: 0;
  margin-bottom: 2rem;
}

footer {
  text-align: center;
  font-family: "Code", serif;
}

.profile-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  opacity: 0.6;
  font-size: 0.85rem;
}

.profile-footer a {
  color: var(--detail);
  text-decoration: none;
}

.profile-footer a:hover {
  text-decoration: underline;
}

/* ===========================================
   LAYOUT UTILITIES
   =========================================== */

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  justify-items: center;
  max-width: 300px;
  margin: 0 auto;
}

.button-stack {
  display: flex;
  gap: 0.5em;
}

/* ===========================================
   SPECIFIC COMPONENTS
   =========================================== */

/* Login/Signup containers */
.login-container,
.signup-container {
  display: flex;
  flex-direction: column;
  max-width: 400px;
  width: 100%;
  background: var(--light-background);
  padding: 2rem;
}

/* Big buttons for landing */
.big-button {
  font-family: "YoungSerifBold";
  font-size: 16px;
  color: var(--detail);
  background: var(--light-background);
  padding: 20px 30px;
  border: 1px solid var(--detail);
  width: 150px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.big-button:hover {
  background: var(--background);
  text-decoration: none;
}

/* Logo */
.logo {
  font-family: "YoungSerifBold";
  color: var(--detail);
  font-size: 24px;
}

.tagline {
  font-family: "Code", serif;
}

/* Signup steps */
.signup-step {
  display: none;
}

.signup-step.active {
  display: block;
}

/* Skip link */
.skip-link {
  text-align: center;
  margin-top: 1rem;
}

.skip-link a {
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.7;
}

.skip-link a:hover {
  text-decoration: underline;
}

/* Footer link */
.foot-link {
  margin-top: 0.5em;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary-dark);
  margin-right: 0.5rem;
}

.status-indicator.active {
  background: var(--success);
}

/* Amount styling */
.amount-in {
  color: var(--success);
}

.amount-out {
  opacity: 0.7;
}

/* File upload */
.file-upload-area {
  background: var(--surface-muted);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-bottom: 1rem;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  background: var(--border);
}

/* Price input */
.price-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.price-input-group input {
  width: 150px;
}

/* Chart placeholder */
.chart-container {
  background: var(--surface-muted);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-header h2 {
  font-size: 1.2rem;
  font-weight: normal;
}

.chart-placeholder {
  background: var(--background);
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

/* Time selector */
.time-selector {
  display: flex;
  gap: 0.5rem;
}

.time-selector button {
  background: var(--light-background);
  border: none;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.6;
}

.time-selector button.active {
  opacity: 1;
  background: var(--primary-dark);
  color: var(--primary-light);
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.analytics-card {
  background: var(--surface-muted);
  padding: 1.5rem;
}

.analytics-card h3 {
  font-size: 1rem;
  font-weight: normal;
  margin-bottom: 1rem;
}

.analytics-list {
  list-style: none;
}

.analytics-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

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

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-box {
  background: var(--surface-muted);
  padding: 1rem;
}

.metric-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.5rem;
}

/* Quick actions */
.quick-actions {
  background: var(--surface-muted);
  padding: 1.5rem;
}

.quick-actions h2 {
  font-size: 1.2rem;
  font-weight: normal;
  margin-bottom: 1rem;
}

/* Filter controls */
.filter-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-label {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Search box */
.search-box {
  background: var(--background);
  border: none;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  flex: 1;
  min-width: 200px;
}

.search-box::placeholder {
  opacity: 0.5;
}

/* UUID styling */
.uuid {
  font-family: inherit;
  opacity: 0.5;
  font-size: 0.85rem;
}

/* Thumbnail styles */
.thumbnail-preview {
  width: 200px;
  height: 200px;
  background: var(--surface-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

/* File list */
.file-list {
  list-style: none;
  margin-top: 1rem;
}

.file-item {
  background: var(--surface-muted);
  padding: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-info {
  flex: 1;
}

.file-name {
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.file-details {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* Library container */
.library-container {
  background: var(--light-background);
  padding: 1.5rem;
}

/* Footer stats */
.footer-stats {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* API hint (hidden) */
.api-hint {
  display: none;
}
