/* =========================================================================
   AI Accounting Prototype – SuperTwentyPlus
   Layout + Neon-ish theming
   - Keep structure simple and extensible for future phases
   ========================================================================= */

/* Base layout + theme variables */
:root {
  --bg: #030712;
  --bg-elevated: rgba(12, 18, 36, 0.96);
  --bg-panel: rgba(12, 18, 36, 0.96);
  --border: #1f2937;
  --accent: #00ffff;
  --accent-soft: #22c1dc;
  --accent-strong: #06b6d4;
  --text: #e5f4ff;
  --text-muted: #8ca5c7;
  --danger: #f97373;
  --success: #4ade80;
  --warning: #facc15;
  --shadow-soft: 0 0 24px rgba(0, 255, 255, 0.18);
}

/* Light mode override */
[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --border: #d1d5db;
  --accent: #0ea5e9;
  --accent-soft: #22c1dc;
  --accent-strong: #0284c7;
  --text: #020617;
  --text-muted: #6b7280;
  --shadow-soft: 0 0 16px rgba(14, 165, 233, 0.18);
}

/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 10% 0%, #082f49 0%, transparent 55%),
    radial-gradient(circle at 90% 100%, #0369a1 0%, transparent 55%),
    radial-gradient(circle at 50% 100%, #0f172a 0%, #000 70%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Floating menu – top bar */
.floating-menu {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.95),
    rgba(8, 47, 73, 0.95)
  );
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(14px);
}

.floating-menu .brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--accent);
}

.floating-menu ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  padding: 0;
  margin: 0;
  align-items: center;
}

.floating-menu a {
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.floating-menu a:hover {
  color: var(--accent);
}

.theme-toggle {
  margin-left: 1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  cursor: pointer;
}

/* App shell */
.app-shell {
  width: 100%;
  max-width: 1180px;
  margin: 1.5rem auto 0;
  padding: 0 1rem 5rem;
  flex: 1 1 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.app-header h1 {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
}

.subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
  font-size: 0.8rem;
}

.status-pill {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: var(--shadow-soft);
}

.last-sync {
  color: var(--text-muted);
}

/* Main grid */
.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1.4fr) minmax(0, 260px);
  gap: 1rem;
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1rem 1.2rem;
  min-height: 0;
}

.panel-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-center {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.field span {
  color: var(--text-muted);
}

.field select,
.field input[type="date"],
.field input[type="text"],
.field input[type="number"] {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  font-size: 0.8rem;
}

[data-theme="light"] .field select,
[data-theme="light"] .field input[type="date"],
[data-theme="light"] .field input[type="text"],
[data-theme="light"] .field input[type="number"] {
  background: #ffffff;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.checkbox-field {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
}

.checkbox-field input {
  margin-top: 0.1rem;
}

/* Status */
.books-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.7);
}

.dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
}

.dot-open {
  background: var(--warning);
}

.dot-ok {
  background: var(--success);
}

/* Buttons */
.btn-primary,
.btn-outline,
.btn-ghost {
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.07s ease-out, box-shadow 0.07s ease-out,
    background 0.07s ease-out;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-strong));
  border-color: rgba(34, 211, 238, 0.7);
  color: #020617;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.7);
}

.btn-outline {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.7);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--accent);
}

.full-width {
  width: 100%;
}

.source-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Dividers */
.panel-divider {
  border: 0;
  height: 1px;
  background: radial-gradient(circle, rgba(148, 163, 184, 0.7), transparent);
  margin: 0.75rem 0;
}

/* Tabs */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(15, 23, 42, 0.96), transparent);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.tab {
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.tab.active {
  background: rgba(15, 23, 42, 0.96);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.5);
}

.tab-panel {
  display: none;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.tab-panel.active {
  display: block;
}

.inbox-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.inbox-filters {
  display: flex;
  gap: 0.6rem;
}

/* Transactions list */
.txn-list {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.txn-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at 0 0, rgba(34, 211, 238, 0.12), transparent);
  cursor: pointer;
}

.txn-card:hover {
  border-color: var(--accent);
}

.txn-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.txn-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.txn-desc {
  font-size: 0.85rem;
}

.txn-category {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.txn-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.tag-confidence {
  border-color: rgba(52, 211, 153, 0.8);
  color: var(--success);
}

.tag-flagged {
  border-color: rgba(248, 113, 113, 0.8);
  color: var(--danger);
}

.txn-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-end;
}

.txn-amount {
  font-weight: 600;
}

/* Dashboard KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.kpi-card {
  border-radius: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at 0 0, rgba(34, 211, 238, 0.16), transparent);
  padding: 0.6rem 0.7rem;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.2rem;
  margin-top: 0.2rem;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.chart-placeholder {
  margin-top: 0.9rem;
  border-radius: 0.7rem;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  padding: 0.8rem;
}

/* Books */
.books-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.books-card {
  border-radius: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.6rem 0.7rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.4rem;
  font-size: 0.8rem;
}

.summary-table th {
  text-align: left;
  padding: 0.2rem 0.2rem 0.2rem 0;
  color: var(--text-muted);
  font-weight: 500;
}

.summary-table td {
  text-align: right;
  padding: 0.2rem 0 0.2rem 0.2rem;
}

/* Right panel – AI */
.ai-summary {
  min-height: 6rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ai-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.notes-box {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  resize: vertical;
}

[data-theme="light"] .notes-box {
  background: #ffffff;
}

/* Footer */
.app-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(10, 16, 32, 0.95);
  padding: 0.6rem 1.5rem;
  margin-top: 1.5rem;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--accent);
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

/* Utilities */
.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.75rem;
}

/* Responsive tweaks */
@media (max-width: 1024px) {
  .app-grid {
    grid-template-columns: minmax(0, 260px) minmax(0, 2fr);
    grid-template-rows: auto auto;
  }

  .panel-right {
    grid-column: 1 / -1;
  }

  .inbox-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .inbox-filters {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .app-shell {
    margin-top: 1rem;
    padding-bottom: 4rem;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-meta {
    align-items: flex-start;
  }

  .app-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    padding: 0.9rem;
  }

  .books-grid,
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .floating-menu ul {
    display: none; /* keep prototype simple on mobile */
  }
}
