/* Korpora — controls shared by every page: buttons, forms, chips, flash messages, tables, the brand mark and the
   language switch. Tokens come from base.css. */

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 42px;
  padding: 0 1.05em;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: 550 0.95rem/1 var(--f-text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--ink-2);
}
.btn-primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--on-green);
}
.btn-primary:hover {
  border-color: var(--ink);
}
.btn-danger {
  color: var(--red);
  border-color: currentColor;
  background: transparent;
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
  min-height: 36px;
  padding: 0 0.6em;
}
.btn-quiet:hover {
  color: var(--ink);
  border-color: var(--rule);
}
.btn-small {
  min-height: 34px;
  padding: 0 0.75em;
  font-size: 0.86rem;
}
.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}
/* a 320px phone: a long label („Прекрати всички други сесии“) wraps inside the button instead of widening the page */
@media (max-width: 400px) {
  .btn {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    padding-block: 6px;
  }
}

/* forms */
.field {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
}
.field > label {
  font-weight: 550;
  font-size: 0.93rem;
}
.hint {
  color: var(--ink-2);
  font-size: 0.86rem;
  margin: 0;
  overflow-wrap: anywhere;
}
/* a hint between two fields belongs to the one above it: it keeps the rhythm of a field (16px) to the next label,
   instead of sitting glued to it */
.form > .hint,
.auth-card > .hint,
fieldset > .hint {
  margin: 4px 0 16px;
}
input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='number'],
input[type='date'],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  /* the edge is the only thing that marks a field: --ink-3 keeps it above 3:1 on the panel and the paper */
  border: 1px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: 400 1rem/1.3 var(--f-text);
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}
input:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-2);
}
input[aria-invalid='true'] {
  border-color: var(--red);
}
/* `input.` outranks input[type='text'] above; at 1.3rem a recovery code (xxxxx-xxxxx) still fits the field on a
   320px phone */
input.code-input {
  font: 500 1.3rem/1 var(--f-mono);
  letter-spacing: 0.3em;
  text-align: center;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.95rem;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--green);
  flex: none;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
legend {
  padding: 0;
  font-weight: 650;
  margin-bottom: 8px;
}

/* status chips: the colour never carries the meaning alone — every chip has an icon and a word */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.15em 0.6em 0.15em 0.45em;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  color: var(--ink-2);
  font: 550 0.8rem/1.5 var(--f-text);
  white-space: nowrap;
}
.chip .i {
  width: 1em;
  height: 1em;
}
.chip-ok {
  color: var(--green);
  border-color: currentColor;
  background: var(--green-soft);
}
.chip-warn {
  color: var(--amber);
  border-color: currentColor;
  background: var(--amber-soft);
}
.chip-bad {
  color: var(--red);
  border-color: currentColor;
  background: var(--red-soft);
}
.chip-gold {
  color: var(--gold-ink);
  border-color: currentColor;
  background: var(--gold-soft);
}

/* flash messages */
.flash {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--panel);
  margin: 0 0 18px;
}
.flash .i {
  margin-top: 2px;
}
.flash-ok {
  border-color: var(--green);
  background: var(--green-soft);
}
.flash-error {
  border-color: var(--red);
  background: var(--red-soft);
}
.flash-info {
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
  color: var(--ink-2);
  background: var(--panel-2);
  font-size: 0.84rem;
}
tr:last-child td {
  border-bottom: 0;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}

/* the logo (views/partials/logo.ejs): its size comes with it, set where it is used; it is drawn for a dark ground
   and reads on the light paper as well, so both themes show the same picture */
.brand {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  text-decoration: none;
}
.brand .logo {
  display: block;
  max-width: 100%;
  height: auto;
}
/* on the dark paper the logo's dark metal letters sit in the same tone: a thin warm rim and a soft glow in the logo's
   own gold keep the word legible without touching the picture */
@media (prefers-color-scheme: dark) {
  .brand .logo {
    filter: drop-shadow(0 0 1px rgb(255 240 215 / 0.5)) drop-shadow(0 0 6px rgb(231 173 44 / 0.18));
  }
}

/* language switch */
.langs {
  display: flex;
  gap: 2px;
  font-size: 0.85rem;
}
.langs a {
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--ink-2);
  text-decoration: none;
}
.langs a[aria-current='true'] {
  color: var(--ink);
  font-weight: 650;
  background: var(--panel-2);
}
