/* app-shell.css — layout + shared components for the logged-in web app
   (/dashboard, /tax, /integrations, /account). Loads after nule.css, which
   owns the :root tokens, the reset and the body opacity→ready reveal. */

:root {
  --text: #E0E0E0;
  --text-dim: #A0A0A0;
  --text-mute: #888;
  --card: #131313;
  --line: #2a2a2a;
  --line-soft: #1c1c1c;
  --mint-soft: rgba(0,255,157,0.12);
  --orange-soft: rgba(255,95,21,0.12);
  --red-soft: rgba(255,49,49,0.12);
}

html, body { min-height: 100%; }
body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
}
body.ready { opacity: 1; }

/* ─── Shell ─── */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.shell-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  padding: 22px 16px;
}
.shell-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  padding: 4px 8px 22px;
}
.shell-logo img { width: 32px; height: 32px; border-radius: 7px; }
.shell-logo span { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }

.shell-links { display: flex; flex-direction: column; gap: 4px; }
.shell-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.shell-link:hover { background: var(--surface-2); color: #fff; }
.shell-link.active { background: var(--orange-soft); color: var(--orange); }
.shell-link svg { width: 18px; height: 18px; flex: none; }

.shell-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shell-email {
  font-size: 12px;
  color: var(--text-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}
.shell-site { font-size: 12px; color: var(--text-mute); text-decoration: none; padding: 0 4px; }
.shell-site:hover { color: var(--text); }

.shell-main {
  min-width: 0;
  padding: 32px 40px 80px;
}

.shell-topbar { display: none; }
.shell-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ─── Page header ─── */
.page-head { margin-bottom: 28px; }
.page-title { font-size: 28px; font-weight: 700; color: #fff; margin-bottom: 6px; letter-spacing: -0.01em; }
.page-sub { color: var(--text-mute); font-size: 14px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 12px;
}
.section-head h2 { font-size: 16px; font-weight: 700; color: #fff; }
.section-head .count { font-size: 13px; color: var(--text-mute); }
.section-head.danger h2 { color: #FF7A7A; }

/* ─── Cards / rows ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.card-danger { border-color: rgba(255,49,49,0.25); }
.card-danger .card-title { color: #FF7A7A; }
.card p.muted, .muted { color: var(--text-mute); font-size: 13px; line-height: 1.5; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row-label { color: var(--text-dim); font-size: 14px; }
.row-value { color: var(--text); font-size: 14px; font-weight: 500; text-align: right; }
.row-value a { color: var(--orange); text-decoration: none; }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.list-item-main { min-width: 0; }
.list-item-title { font-size: 14.5px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-sub { font-size: 13px; color: var(--text-mute); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-aside { font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; }
.list-item-aside.danger { color: #FF7A7A; }
.list-empty {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ─── Stats ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; margin-top: 6px; letter-spacing: -0.02em; }
.stat-value.mint { color: var(--mint); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: #FF7A7A; }
.stat-note { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

/* ─── Integration detail view ─── */
.back-link { display: inline-block; font-size: 13px; color: var(--text-dim); margin-bottom: 18px; text-decoration: none; }
.back-link:hover { color: #fff; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.detail-title { font-size: 24px; color: #fff; margin: 0 0 6px; }
.detail-sub { font-size: 14px; color: var(--text-dim); max-width: 720px; margin: 0; line-height: 1.5; }
.detail .panel { grid-column: auto; }

/* ─── Tiles (integrations) ─── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 190px;
}
.tile.open { border-color: var(--orange); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tile-name { font-size: 17px; font-weight: 700; color: #fff; }
.tile-blurb { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; flex: 1; }
.tile-meta { font-size: 12px; color: var(--text-mute); }
.tile-meta.error { color: #FF7A7A; }
.tile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--orange);
  border-radius: 14px;
  padding: 24px 28px;
  margin-top: -4px;
}
.panel h3 { font-size: 18px; color: #fff; margin-bottom: 14px; }
.panel h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); margin: 18px 0 10px; }
.panel ol, .panel ul { padding-left: 20px; color: #c9c9c9; font-size: 14px; line-height: 1.6; }
.panel li { margin-bottom: 6px; }
.panel p { color: #c9c9c9; font-size: 14px; line-height: 1.6; }
.panel code { font-family: var(--font-display); font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; color: var(--mint); word-break: break-all; }

/* ─── Forms ─── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-dim); }
.input, .field input[type="text"], .field input[type="password"], .field input[type="date"], .field select, .field textarea {
  background: #161616;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}
.input:focus, .field input:focus, .field select:focus, textarea.input:focus { outline: none; border-color: var(--orange); }
textarea.input { resize: vertical; line-height: 1.5; min-height: 120px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline .input { flex: 1; min-width: 180px; width: auto; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: #444; color: #fff; }
.chip.active { background: var(--orange-soft); border-color: var(--orange); color: var(--orange); }

.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.radio-item.active { border-color: var(--orange); }
.radio-item input { margin-top: 4px; accent-color: var(--orange); }
.radio-label { font-size: 14px; font-weight: 600; color: #fff; }
.radio-desc { font-size: 12.5px; color: var(--text-mute); margin-top: 2px; }
.radio-caveat { font-size: 12px; color: #FF9D67; margin-top: 4px; }

.toggle-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; color: var(--text); }
.toggle-row input { accent-color: var(--orange); width: 16px; height: 16px; }
.toggle-row.disabled { opacity: 0.45; }

/* ─── Buttons ─── */
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn {
  background: #1f1f1f;
  border: 1px solid #333;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  min-height: 40px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { background: #262626; border-color: #444; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:hover { background: #ff7a3d; border-color: #ff7a3d; }
.btn-danger { background: transparent; border-color: rgba(255,49,49,0.4); color: #FF7A7A; }
.btn-danger:hover { background: rgba(255,49,49,0.08); border-color: var(--red); }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); }

/* ─── Status pills ─── */
.status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status.active, .status.connected, .status.available { background: var(--mint-soft); color: var(--mint); }
.status.cancelled, .status.pending { background: var(--orange-soft); color: #FF9D67; }
.status.past_due, .status.error { background: var(--red-soft); color: #FF7A7A; }
.status.none, .status.not_connected { background: rgba(160,160,160,0.12); color: var(--text-dim); }

/* ─── Messages ─── */
.msg {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.msg.show { display: block; }
.msg.error   { background: rgba(255,49,49,0.1); border: 1px solid rgba(255,49,49,0.3); color: #FF7A7A; }
.msg.success { background: rgba(0,255,157,0.1); border: 1px solid rgba(0,255,157,0.3); color: var(--mint); }
.msg.info    { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }

.empty { text-align: center; padding: 24px 0; }
.empty p { color: var(--text-mute); font-size: 14px; margin-bottom: 16px; }
.loading { text-align: center; padding: 60px 0; color: #555; }

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface-2);
  border: 1px solid #333;
  border-radius: 14px;
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 32px);
}
.modal-title { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 10px; }
.modal-body  { font-size: 14px; color: var(--text-dim); line-height: 1.55; margin-bottom: 20px; }
.modal-body input {
  width: 100%;
  margin-top: 14px;
  background: var(--surface-3);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .shell-nav {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .shell-nav.open { transform: translateX(0); }
  .shell-backdrop.show { display: block; }
  .shell-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 80;
  }
  .shell-topbar img { width: 28px; height: 28px; border-radius: 6px; }
  .shell-topbar span { font-family: var(--font-display); font-weight: 700; color: #fff; }
  .shell-burger {
    background: none;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    width: 38px; height: 38px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }
  .shell-main { padding: 20px 16px 60px; }
  .panel { padding: 18px; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 24px; }
}

[hidden] { display: none !important; }
select.input { width: auto; max-width: 100%; }

/* The offer kept from sign-up (see AccountPage.showPendingOffer) */
.empty .offer-note { color: var(--text); border-left: 3px solid #FF5F15; padding-left: 12px; text-align: left; }
