/* Claude Trading dashboard — Catppuccin Mocha-flavored, mobile-first.
 * Single hand-written stylesheet, no framework. ~200 lines.
 * Tables become horizontally-scrollable on narrow viewports; cards stack.
 */

:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --muted: #6c7086;
  --rosewater: #f5e0dc;
  --red: #f38ba8;
  --maroon: #eba0ac;
  --peach: #fab387;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --sky: #89dceb;
  --sapphire: #74c7ec;
  --blue: #89b4fa;
  --lavender: #b4befe;
  --mauve: #cba6f7;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               sans-serif;
  background: var(--base);
  color: var(--text);
  line-height: 1.45;
  font-size: 16px;
}

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

h1, h2, h3, h4 { color: var(--lavender); margin: 0 0 0.5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

.muted { color: var(--muted); }
.up    { color: var(--green); }
.down  { color: var(--red); }

/* --- top nav ----------------------------------------------------------- */
.topnav {
  background: var(--mantle);
  border-bottom: 1px solid var(--surface0);
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.topnav .brand { font-weight: 700; color: var(--mauve); }
.topnav nav    { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.topnav nav a  { color: var(--subtext); }
.topnav nav a:hover { color: var(--text); }
.logout-form { margin: 0; }
.link-button {
  background: none; border: 0; color: var(--subtext);
  cursor: pointer; padding: 0; font: inherit;
}
.link-button:hover { color: var(--red); }

/* --- kill banner ------------------------------------------------------- */
.kill-banner {
  background: var(--red);
  color: var(--crust);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-weight: 600;
}
.kill-banner small { font-weight: 400; opacity: 0.85; }

/* --- page + cards ------------------------------------------------------ */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 1rem;
}
.card + .card { margin-top: 0; }

/* --- key/value lists --------------------------------------------------- */
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0;
}
.kv dt { color: var(--subtext); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.kv dd.total { font-weight: 700; color: var(--peach); }

/* --- tables (mobile: horizontally scroll) ------------------------------ */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--surface0);
  white-space: nowrap;
}
th { color: var(--subtext); font-weight: 600; }
tbody tr:hover { background: var(--surface0); }

/* --- status pills ------------------------------------------------------ */
.status {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface0);
  color: var(--text);
  text-transform: lowercase;
}
.status-pending  { background: var(--yellow); color: var(--crust); }
.status-executed { background: var(--green);  color: var(--crust); }
.status-filled   { background: var(--green);  color: var(--crust); }
.status-rejected { background: var(--red);    color: var(--crust); }
.status-expired  { background: var(--surface1); color: var(--subtext); }
.status-error    { background: var(--red);    color: var(--crust); }
.status-info     { background: var(--sapphire); color: var(--crust); }
.status-warning  { background: var(--peach);  color: var(--crust); }

/* --- proposal stub list ------------------------------------------------ */
.proposal-stub-list { list-style: none; padding: 0; margin: 0; }
.proposal-stub-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--surface0);
}

/* --- proposal detail --------------------------------------------------- */
.order {
  border: 1px solid var(--surface0);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.order header {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline;
  margin-bottom: 0.5rem;
}
.conviction-high   { border-left-color: var(--green); }
.conviction-medium { border-left-color: var(--yellow); }
.conviction-low    { border-left-color: var(--muted); }

.side { padding: 0.05rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
.side-buy  { background: var(--green); color: var(--crust); }
.side-sell { background: var(--red);   color: var(--crust); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.actions form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0; }

button {
  background: var(--surface0);
  color: var(--text);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  cursor: pointer;
}
button:hover { background: var(--surface1); }
button.primary { background: var(--green); color: var(--crust); border-color: var(--green); }
button.primary:hover { filter: brightness(1.05); }
button.danger  { background: var(--red);   color: var(--crust); border-color: var(--red); }
button.danger:hover  { filter: brightness(1.05); }

input[type="text"], input[type="password"], input[type="number"] {
  background: var(--base);
  color: var(--text);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  min-width: 0;
}

/* --- markdown blocks --------------------------------------------------- */
.md { line-height: 1.55; }
.md p { margin: 0.4rem 0; }
.md pre {
  background: var(--crust);
  border: 1px solid var(--surface0);
  border-radius: 6px;
  padding: 0.5rem;
  overflow-x: auto;
}
.md code {
  background: var(--crust);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}
.md table { margin: 0.5rem 0; }
.md h1, .md h2, .md h3 { color: var(--text); }

/* --- manual forms grid ------------------------------------------------- */
.manual-forms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.manual-form label { display: block; margin-bottom: 0.5rem; }
.manual-form input { width: 100%; }

@media (min-width: 640px) {
  .manual-forms { grid-template-columns: 1fr 1fr; }
}

/* --- login page -------------------------------------------------------- */
.login-page {
  background: var(--base);
  display: flex; min-height: 100vh; align-items: center; justify-content: center;
}
.login-shell {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 1.5rem;
  width: min(360px, 92vw);
}
.login-form { display: flex; flex-direction: column; gap: 0.75rem; }
.login-form label { display: flex; flex-direction: column; gap: 0.25rem; }
.error { color: var(--red); font-weight: 600; }

/* --- error/rejection helpers ------------------------------------------- */
.reject-form input { width: 12rem; max-width: 100%; }
