/* =========================================================================
   Orangeprint
   Minimal stylesheet for the scaffold. Styled to be clean and legible but
   intentionally plain. Expand and replace as you build out the MVP.
   ========================================================================= */

:root {
  --color-bg: #f7f7f5;
  --color-surface: #ffffff;
  --color-border: #e4e4e0;
  --color-text: #1f1f1f;
  --color-muted: #6b6b6b;
  --color-primary: #e8683a;
  --color-primary-dark: #c9542b;
  --color-accent: #2a2a2a;
  --color-success: #2f8f5f;
  --color-warning: #b07a1a;
  --color-danger: #b94a3a;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --font-stack: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.5;
}

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

h1, h2, h3 { margin: 0 0 0.5rem; font-weight: 600; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.muted { color: var(--color-muted); }

/* -------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------- */
.app-main {
  margin-left: 240px;
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

.app-main--auth {
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

.app-sidebar__brand {
  padding: 0 1.25rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-sidebar__brand a { color: var(--color-primary); }
.app-sidebar__brand a:hover { text-decoration: none; }

.app-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-nav a {
  padding: 0.6rem 1.25rem;
  color: #d4d4d4;
  font-size: 0.95rem;
}

.app-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}

.app-nav a.is-active {
  background: rgba(232, 104, 58, 0.15);
  color: #fff;
  border-left: 3px solid var(--color-primary);
  padding-left: calc(1.25rem - 3px);
}

.app-sidebar__user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.app-sidebar__user-name { font-weight: 600; color: #fff; }
.app-sidebar__user-email { color: #9a9a9a; margin-bottom: 0.5rem; }

.app-sidebar__logout button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #d4d4d4;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
}

.app-sidebar__logout button:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* -------------------------------------------------------------------------
   Page header
   ------------------------------------------------------------------------- */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-header__subtitle {
  color: var(--color-muted);
  margin: 0.25rem 0 0;
}

.page-header__meta {
  margin-top: 0.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.page-header__back {
  display: inline-block;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

/* -------------------------------------------------------------------------
   Tabs
   ------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.25rem;
}

.tabs__item {
  padding: 0.5rem 0.9rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs__item:hover {
  color: var(--color-text);
  text-decoration: none;
}

.tabs__item.is-active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
  font-weight: 500;
}

/* -------------------------------------------------------------------------
   Panels and cards
   ------------------------------------------------------------------------- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.panel h2 { margin-bottom: 0.75rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

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

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0.25rem 0;
}

.stat-card__link {
  font-size: 0.85rem;
}

/* -------------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.data-table th {
  background: #fafaf7;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-muted);
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* -------------------------------------------------------------------------
   Badges
   ------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #eee;
  color: #333;
  text-transform: capitalize;
}

.badge--account { background: #e0e6f0; color: #3a5978; }
.badge--person { background: #e8e0ef; color: #614783; }

.badge--prospect, .badge--pending, .badge--todo { background: #e6e6e2; color: #555; }
.badge--active, .badge--in_progress { background: #dbeadb; color: #2f8f5f; }
.badge--paused, .badge--blocked, .badge--priority-high { background: #f6e7cc; color: var(--color-warning); }
.badge--churned, .badge--priority-urgent { background: #f4d7d1; color: var(--color-danger); }
.badge--completed, .badge--done, .badge--skipped { background: #dfdfe6; color: #555; }
.badge--archived { background: #efeee8; color: #777; }
.badge--priority-low { background: #e4e4e0; color: #777; }
.badge--priority-normal { background: #e4eaf0; color: #3a5978; }

/* -------------------------------------------------------------------------
   Kanban (sales pipeline)
   ------------------------------------------------------------------------- */
.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban__column {
  flex: 0 0 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

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

.kanban__count {
  background: #eee;
  color: #555;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.kanban__cards { display: flex; flex-direction: column; gap: 0.5rem; }

.kanban__card {
  background: #fafaf7;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}

.kanban__card-title { font-weight: 600; margin-bottom: 0.15rem; }
.kanban__card-meta { font-size: 0.8rem; color: var(--color-muted); }
.kanban__card-value { font-size: 0.85rem; margin-top: 0.25rem; }
.kanban__empty { font-size: 0.85rem; margin: 0; }

/* -------------------------------------------------------------------------
   Lists
   ------------------------------------------------------------------------- */
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--color-border); }
.plain-list li:last-child { border-bottom: none; }

.kv-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.kv-list dt { color: var(--color-muted); font-size: 0.85rem; }
.kv-list dd { margin: 0; }

.stage-list { list-style: none; padding: 0; margin: 0; }
.stage-list__item { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }
.stage-list__item:last-child { border-bottom: none; }
.stage-list__name { font-weight: 500; }
.stage-list__meta { font-size: 0.85rem; color: var(--color-muted); }

.task-list { list-style: none; padding: 0; margin: 0; }
.task-list__item { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); }
.task-list__item:last-child { border-bottom: none; }
.task-list__item--done .task-list__title { text-decoration: line-through; color: var(--color-muted); }
.task-list__title { font-weight: 500; }
.task-list__meta { font-size: 0.85rem; color: var(--color-muted); margin-top: 0.2rem; display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------------------
   Activity feed
   ------------------------------------------------------------------------- */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-feed__item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
}
.activity-feed__header { font-size: 0.9rem; margin-bottom: 0.3rem; }
.activity-feed__body { white-space: pre-wrap; }

/* -------------------------------------------------------------------------
   Docs
   ------------------------------------------------------------------------- */
.notebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.notebook-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  display: block;
}

.notebook-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}

.notebook-card__title { margin-bottom: 0.25rem; color: var(--color-text); }
.notebook-card__desc { color: var(--color-muted); margin: 0 0 0.5rem; font-size: 0.9rem; }
.notebook-card__meta { font-size: 0.8rem; color: var(--color-muted); }

.notebook-body {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.folder-tree { list-style: none; padding-left: 1rem; margin: 0.25rem 0; }
.folder-tree__folder { margin: 0.25rem 0; }
.folder-tree__folder-name { font-weight: 500; padding: 0.2rem 0; }
.folder-tree__docs { list-style: none; padding-left: 1.25rem; margin: 0.15rem 0; }
.folder-tree__docs--root { padding-left: 0.5rem; }
.folder-tree__docs li { padding: 0.15rem 0; }
.folder-tree__icon { display: inline-block; margin-right: 0.35rem; }

.doc-editor {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: var(--font-stack);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  background: #fafaf7;
}

/* -------------------------------------------------------------------------
   Auth pages
   ------------------------------------------------------------------------- */
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.auth-card__title { margin-bottom: 1.25rem; }

.auth-card__error {
  background: #f4d7d1;
  color: var(--color-danger);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-form__label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
.auth-form__label input {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
}

.auth-form__label input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: var(--color-primary);
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  text-decoration: none;
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn--secondary:hover {
  background: #fafaf7;
  text-decoration: none;
}

.btn--danger {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-border);
}

.btn--danger:hover {
  background: #f4d7d1;
  text-decoration: none;
}

.btn--small {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

.data-table__actions { white-space: nowrap; }
.data-table td.data-table__actions .inline-form + .inline-form { margin-left: 0.35rem; }

/* -------------------------------------------------------------------------
   Banners
   ------------------------------------------------------------------------- */
.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.banner--warning {
  background: #f6e7cc;
  color: var(--color-warning);
}

.banner--danger {
  background: #f4d7d1;
  color: var(--color-danger);
}

/* -------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */
.form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form__label {
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 500;
}

.form__field input,
.form__field select,
.form__field textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}

.form__field input:focus,
.form__field select:focus,
.form__field textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: var(--color-primary);
}

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

.form__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}

.form-errors {
  background: #f4d7d1;
  color: var(--color-danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  max-width: 720px;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.contact-notes {
  white-space: pre-wrap;
  margin: 0;
}

/* -------------------------------------------------------------------------
   Empty and error states
   ------------------------------------------------------------------------- */
.empty-state {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
}

.error-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
}

.error-state__stack {
  text-align: left;
  background: #1f1f1f;
  color: #eee;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8rem;
  margin-top: 1rem;
}
