/* Web portal styles. Mostly opened on a phone, so touch-sized inputs and
   horizontally-scrollable tables matter more than desktop polish.
   No external fonts or images — a strict CSP blocks both. */

:root {
  --bg: #f7f7f5;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #d8d8d4;
  --panel-bg: #ffffff;
  --link: #0a5ad6;
  --positive: #157a3d;
  --negative: #b3261e;
  --warning-bg: #fff4d6;
  --warning-border: #e0b84a;
  --error-bg: #fde8e6;
  --error-fg: #8c1d13;
  --notice-bg: #e4f5e9;
  --notice-fg: #146c34;
  --input-bg: #ffffff;
  --header-bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --fg: #eaeaea;
    --muted: #a2a2a2;
    --border: #34363b;
    --panel-bg: #1f2023;
    --link: #6fa8ff;
    --positive: #4fbf78;
    --negative: #ff6b63;
    --warning-bg: #40350f;
    --warning-border: #a3822c;
    --error-bg: #3a1613;
    --error-fg: #ff9d94;
    --notice-bg: #163a24;
    --notice-fg: #6fdb95;
    --input-bg: #26272b;
    --header-bg: #1f2023;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-size: 16px;
}

a {
  color: var(--link);
}

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
}

.site-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
}

.site-nav a {
  margin-right: 1rem;
  text-decoration: none;
}

/* "Cerrar sesión" is a POST form (it changes state), styled to read as a link. */
.logout-form {
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  width: auto;
  min-height: 0;
  font: inherit;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}

.site-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

h2 {
  font-size: 1.05rem;
  margin-top: 2rem;
}

.greeting {
  font-size: 1.1rem;
}

.balance-summary {
  font-size: 1.2rem;
  font-weight: 600;
}

.balance-positive {
  color: var(--positive);
}

.balance-negative {
  color: var(--negative);
}

.balance-zero {
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--panel-bg);
}

.panel-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.error-message {
  background: var(--error-bg);
  color: var(--error-fg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.notice-message {
  background: var(--notice-bg);
  color: var(--notice-fg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.identity-badge {
  display: inline-flex;
  gap: 0.3rem;
  margin: 0 0.3rem 0.3rem 0;
}

.explainer {
  color: var(--muted);
}

/* Tables scroll horizontally on narrow screens instead of squeezing columns. */
.table-scroll {
  overflow-x: auto;
  margin: 0.5rem 0 1rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  background: var(--panel-bg);
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.chat-list,
.transfer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chat-list li,
.transfer-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

/* Forms: inputs and buttons sized for touch. */
form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 360px;
}

.inline-form {
  flex-direction: row;
  max-width: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select,
button {
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  min-height: 2.6rem;
}

input,
select {
  background: var(--input-bg);
  color: var(--fg);
}

button {
  background: var(--link);
  color: #fff;
  border: none;
  cursor: pointer;
}

button:active {
  opacity: 0.85;
}

.auth-form {
  margin-top: 1rem;
}

.auth-alt-link {
  margin-top: 1rem;
}
