* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface2: #0f3460;
  --accent: #2ecc71;
  --text: #eee;
  --text-muted: #999;
  --green: #27ae60;
  --yellow: #f39c12;
  --red: #e74c3c;
  --border: #2a2a4a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  width: 320px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}
.login-box h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  color: var(--accent);
}
.login-box input {
  width: 100%;
  padding: .7rem;
  margin-bottom: .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
}
.login-box button {
  width: 100%;
  padding: .7rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
}
.login-box button:hover { opacity: .9; }
.login-error {
  color: var(--red);
  text-align: center;
  margin-bottom: .5rem;
  font-size: .85rem;
  min-height: 1.2rem;
}

/* App shell */
.app { display: none; flex-direction: column; min-height: 100vh; }
.app.active { display: flex; }

/* Header */
.header {
  background: var(--surface);
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.header-title { font-size: 1.1rem; font-weight: 600; }
.header-user { display: flex; align-items: center; gap: .8rem; }
.header-user span { color: var(--text-muted); font-size: .85rem; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .3rem .7rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .8rem;
}
.btn-logout:hover { color: var(--text); border-color: var(--text-muted); }

/* Navigation breadcrumb */
.breadcrumb {
  padding: .5rem 1rem;
  background: var(--surface2);
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-muted); }
.breadcrumb .current { color: var(--text); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: .6rem 1.2rem;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Summary cards */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .8rem;
  padding: 1rem;
}
.card {
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}
.card-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .3rem;
}
.card-value {
  font-size: 1.4rem;
  font-weight: 700;
}
.card-sub {
  font-size: .8rem;
  margin-top: .2rem;
  opacity: .85;
}

/* Data table */
.table-wrap {
  flex: 1;
  overflow: auto;
  padding: 0 1rem 1rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: .6rem .5rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  cursor: pointer;
  transition: background .1s;
}
tbody tr:hover { background: var(--surface2); }
td {
  padding: .5rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Margin colors */
.margin-green { color: var(--green); font-weight: 600; }
.margin-yellow { color: var(--yellow); font-weight: 600; }
.margin-red { color: var(--red); font-weight: 600; }

/* Stacked volume @ margin cell */
.vol-cell { line-height: 1.2; }
.vol-cell .vol-count { font-weight: 600; }
.vol-cell .vol-margin { font-size: .75rem; opacity: .85; }

/* Forecast cards */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}
.forecast-card {
  background: var(--surface);
  padding: 1.2rem;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}
.forecast-card h3 {
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: .5rem;
}
.forecast-card .val {
  font-size: 1.6rem;
  font-weight: 700;
}

/* Contacts / Email */
.contacts-wrap { padding: 1rem; }
.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  padding: .6rem 1rem;
  border-radius: 6px;
  margin-bottom: .5rem;
}
.contact-row .info { display: flex; gap: 1rem; }

.email-form {
  max-width: 500px;
  padding: 1rem;
}
.email-form label {
  display: block;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .3rem;
  margin-top: .8rem;
}
.email-form input,
.email-form textarea {
  width: 100%;
  padding: .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
}
.email-form textarea { min-height: 120px; resize: vertical; }
.btn-send {
  margin-top: 1rem;
  padding: .6rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
}
.btn-send:hover { opacity: .9; }

/* Utility */
.hidden { display: none !important; }
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Nav buttons row */
.nav-actions {
  display: flex;
  gap: .5rem;
  padding: .5rem 1rem;
  flex-wrap: wrap;
}
.nav-btn {
  padding: .4rem .8rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: .8rem;
}
.nav-btn:hover { background: var(--accent); border-color: var(--accent); }

/* Responsive */
@media (max-width: 600px) {
  .summary { grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: .5rem; }
  .card-value { font-size: 1.1rem; }
  .tabs { overflow-x: auto; }
  .tab { padding: .5rem .8rem; font-size: .8rem; }
}
