/* AESOP Wargame — dark design system (standalone, no aesop_ui dependency) */
:root {
  --bg: #0f1117;
  --bg-secondary: #171a23;
  --bg-elevated: #1e222d;
  --border: #2a2f3d;
  --text-primary: #e6e8ef;
  --text-secondary: #b8bccb;
  --text-muted: #7f8597;
  --text-bright: #ffffff;
  --accent: #3b82f6;
  --accent-highlight: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --navbar-height: 52px;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-primary); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--accent-highlight); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--text-bright); margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .85em; }
[x-cloak] { display: none !important; }

/* Navbar */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-height); z-index: 1000;
  background: linear-gradient(180deg, #151925, #10131b); border-bottom: 1px solid var(--border); }
.navbar-container { height: 100%; display: flex; align-items: center; gap: 1.25rem; padding: 0 1rem; }
.navbar-brand { display: flex; align-items: center; gap: .5rem; color: var(--text-bright); font-size: .95rem; letter-spacing: .04em; }
.navbar-brand:hover { text-decoration: none; }
.brand-icon { color: var(--accent-highlight); font-size: 1.2rem; }
.navbar-links { display: flex; gap: .25rem; flex: 1; }
.nav-link { color: var(--text-secondary); padding: .35rem .7rem; border-radius: 6px; font-size: .9rem; }
.nav-link:hover { background: var(--bg-elevated); color: var(--text-bright); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-highlight); }
.navbar-actions { display: flex; align-items: center; gap: .5rem; }
.navbar-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary); }
.navbar-btn:hover { text-decoration: none; border-color: var(--accent); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; margin: 0; padding: .35rem 0; list-style: none;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.45);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: all .15s ease; }
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { padding: .4rem .9rem; color: var(--text-muted); font-size: .8rem; border-bottom: 1px solid var(--border); }
.dropdown-item { display: block; width: 100%; text-align: left; padding: .45rem .9rem; color: var(--text-primary); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-item:hover { background: var(--accent-soft); color: var(--text-bright); text-decoration: none; }

/* Layout */
.main-content { margin-top: var(--navbar-height); min-height: calc(100vh - var(--navbar-height)); }
.main-content.full-bleed { padding: 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; }
.messages { max-width: 1200px; margin: .75rem auto 0; padding: 0 1rem; }
.message { padding: .5rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-secondary); margin-bottom: .5rem; }
.message-success { border-color: var(--success); } .message-error { border-color: var(--danger); } .message-warning { border-color: var(--warning); }

/* Explainer — every page opens with one */
.explainer { background: var(--bg-secondary); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: .7rem 1rem; color: var(--text-secondary); margin-bottom: 1rem; }

/* Cards */
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.hero { padding: 2rem 0 1rem; max-width: 900px; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--text-secondary); font-size: 1rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.feature-card { display: block; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem;
  color: var(--text-primary); transition: transform .15s ease, border-color .15s ease; }
.feature-card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.feature-card-muted { opacity: .75; }
.feature-icon { font-size: 1.6rem; margin-bottom: .5rem; color: var(--accent-highlight); }
.feature-card p { color: var(--text-secondary); }
.feature-link { color: var(--accent-highlight); font-size: .9rem; }
.steps li { margin-bottom: .5rem; color: var(--text-secondary); }
.steps strong { color: var(--text-bright); }
.dashboard-header p { color: var(--text-muted); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; }
.stat-value { font-size: 1.8rem; font-weight: 600; color: var(--text-bright); }
.stat-label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

/* Forms & buttons */
.form-group { margin-bottom: .9rem; }
.form-group label { display: block; margin-bottom: .3rem; color: var(--text-secondary); font-size: .85rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .7rem; font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-help { color: var(--text-muted); font-size: .78rem; margin-top: .25rem; }
.form-help ul { margin: .2rem 0 0 1rem; padding: 0; }
.form-errors { background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .5); color: #fca5a5; border-radius: 6px; padding: .4rem .7rem; margin-bottom: .6rem; font-size: .85rem; }
.form-errors ul { margin: 0; padding-left: 1rem; }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-primary); font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-highlight); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }

/* Auth */
.auth-wrapper { display: flex; justify-content: center; align-items: flex-start; padding: 3rem 1rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; }
.auth-link { margin-top: 1rem; color: var(--text-muted); font-size: .85rem; text-align: center; }

/* Modal overlay (HTMX-populated) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; width: min(640px, 92vw); max-height: 90vh; overflow: auto; }

/* Tables */
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-weight: 500; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--border); color: var(--text-secondary); }

/* Resizable columns */
.resize-handle { width: 5px; cursor: col-resize; background: var(--border); flex: 0 0 5px; }
.resize-handle:hover, .resize-handle.active { background: var(--accent); }

/* Orders panel */
.orders-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; font-size: .9rem; }
.orders-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1rem; }
.orders-list { list-style: none; margin: .3rem 0 .6rem; padding: 0; }
.orders-list li { padding: .3rem .4rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.orders-list li.infeasible a { color: var(--text-muted); }
.orders-catalogue details summary { cursor: pointer; color: var(--text-bright); padding: .3rem 0; }
.action-form { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.badge-ok { border-color: var(--success); color: var(--success); }
.turn-status { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.preview-table td, .preview-table th { font-size: .82rem; padding: .25rem .4rem; }
.preview-block summary { cursor: pointer; padding: .3rem 0; color: var(--text-bright); font-size: .9rem; }
.pbar { display: inline-block; width: 60px; height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; vertical-align: middle; margin-right: 4px; }
.pbar span { display: block; height: 100%; background: var(--danger); border-radius: 4px; }

/* Chat */
.chat-embed { display: flex; flex-direction: column; height: 380px; }
.chat-status-bar { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--text-muted); padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.chat-channel { width: auto; font-size: .8rem; padding: .2rem .4rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #888; margin-left: 4px; }
.status-dot.connected { background: var(--success); } .status-dot.polling { background: var(--warning); } .status-dot.disconnected { background: var(--danger); }
.messages-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; padding: .5rem .2rem; }
.message { max-width: 85%; padding: .4rem .7rem; border-radius: 12px; font-size: .84rem; }
.message.own { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.message.other { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.message.system { align-self: center; color: var(--text-muted); font-style: italic; font-size: .78rem; }
.msg-sender { font-size: .72rem; opacity: .8; margin-bottom: .1rem; } .msg-time { opacity: .7; }
.shared-card { border: 1px solid var(--border); border-radius: 6px; padding: .2rem .5rem; }
.input-area { display: flex; gap: .4rem; padding-top: .4rem; border-top: 1px solid var(--border); }
.input-area input[type="text"] { flex: 1; border-radius: 20px; }
.chat-btn { padding: .35rem .7rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-primary); cursor: pointer; }
.btn-file { position: relative; overflow: hidden; } .btn-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.empty-state { color: var(--text-muted); font-size: .8rem; text-align: center; padding: 1rem; }
