/* Ordito Console - same palette as ordito.eu, system fonts (nothing to download).
   One file for the shell and the pages of the modules: a module builds its page from the
   pieces below (card, table, badge, form, note) and adds no style sheet of its own. */
:root {
  --paper: #FAF9F7;
  --card: #FFFFFF;
  --line: #E8E5DF;
  --navy: #021637;
  --muted: #626D80;
  --accent: #4257B8;
  --accent-deep: #2F429B;
  --accent-soft: #EEF0FA;
  --danger: #A8321F;
  --danger-soft: #FBEDEA;
}

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

/* The hidden attribute must win over the display values set below. */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--muted);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ the bar on top */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 2rem;
  padding: .9rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--navy);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-decoration: none;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  flex: 1;
}

nav a {
  padding: .35rem .9rem;
  border-radius: 100px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { color: var(--navy); }
nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-deep); }

.account {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  color: var(--navy);
}

/* ------------------------------------------------------------------------- pages */
main {
  display: grid;
  /* minmax(0, ...): a wide table scrolls inside its card instead of widening the page. */
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  padding: 2.5rem 1.5rem;
}

.card {
  width: 100%;
  max-width: 30rem;
  padding: 2.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px -28px rgba(2, 22, 55, .28);
}

.card.wide { max-width: 76rem; }

h1 {
  margin-bottom: .5rem;
  color: var(--navy);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

h2 {
  margin: 2.25rem 0 .75rem;
  color: var(--navy);
  font-size: 1.1rem;
  font-weight: 600;
}

.error { color: var(--danger); }
.note { font-size: .9rem; }

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .5rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

dt { font-size: .9rem; }
dd { color: var(--navy); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------------ tables */
.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}

th, td {
  padding: .7rem 1rem .7rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* A cell stays on one line and the table scrolls sideways on a narrow screen. A cell that
   holds a long text (an address) says "wrap". */
td { color: var(--navy); white-space: nowrap; }
td.wrap { min-width: 14rem; max-width: 26rem; white-space: normal; overflow-wrap: anywhere; }
td.num, th.num { text-align: right; }
td.quiet { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------------ labels */
.badges { display: flex; gap: .35rem; }

.badge {
  display: inline-block;
  padding: .1rem .6rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--navy);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge.accent { border-color: transparent; background: var(--accent-soft); color: var(--accent-deep); }
.badge.muted { color: var(--muted); }
.badge.danger { border-color: transparent; background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------------------------- forms */
form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

label, legend {
  display: block;
  margin-bottom: .3rem;
  color: var(--navy);
  font-size: .9rem;
  font-weight: 500;
}

fieldset { padding: 0; border: 0; }

input[type="text"], input[type="url"], select, textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--navy);
  font: inherit;
}

.choices { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.choices label { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2rem;
}

td .actions, form .actions { margin-top: 0; gap: .4rem; }
td .actions { flex-wrap: nowrap; }

button,
.button {
  padding: .65rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--card);
  color: var(--navy);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

button:hover,
.button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

.account button, button.small { padding: .25rem .75rem; font-size: .85rem; }
button.danger:hover { border-color: var(--danger); color: var(--danger); }

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
}

a { color: var(--accent-deep); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 40rem) {
  .card { padding: 1.5rem; }
  main { padding: 1.25rem .75rem; }
  /* The pages go on a line of their own, under the name of the console and the account. */
  .bar { padding: .75rem 1rem; }
  nav { order: 3; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
