/* Bootstrap 5, restyled (Р-116) — every colour a variable from theme.css.
   No colour literal here or in a template (V1 §18, rules-frontend.md). */

:root {
  --bs-body-bg: var(--sm-bg);
  --bs-body-color: var(--sm-text);
  --bs-emphasis-color: var(--sm-text);
  --bs-secondary-color: var(--sm-muted);
  --bs-tertiary-bg: var(--sm-surface);
  --bs-border-color: var(--sm-border);
  --bs-link-color: var(--sm-accent);
  --bs-link-hover-color: var(--sm-accent-hover);
  --bs-focus-ring-color: var(--sm-focus);
  --bs-body-font-size: 1rem;
}

body {
  background: var(--sm-bg);
  color: var(--sm-text);
  min-height: 100vh;
}

/* One column, a phone's width first (V1 §18). */
.sm-container {
  max-width: 30rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.sm-main {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.sm-bar {
  background: var(--sm-bg);
  border-bottom: 1px solid var(--sm-border);
}

.sm-brand {
  color: var(--sm-text);
  font-weight: 600;
}

.sm-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.sm-lead {
  color: var(--sm-muted);
  margin-bottom: 1.25rem;
}

/* Separated by a border, never a shadow — shadows do not work in the dark. */
.sm-panel {
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 0.75rem;
  padding: 1.25rem 1rem;
}

.sm-gap {
  margin-top: 1rem;
}

/* What ends the order, or opens a case against the other person, stands apart
   from the move of the moment — a thumb's width is not enough on a phone
   (rules-frontend §3, W5a's review). */
.sm-apart {
  margin-top: 2.5rem;
}

.sm-error {
  color: var(--sm-danger);
  margin: 0.5rem 0 0;
}

/* Under a finger: 44 px at the least (V1 §18). */
.btn,
.form-control {
  min-height: 2.75rem;
}

.form-control {
  background-color: var(--sm-bg);
  border-color: var(--sm-border);
  color: var(--sm-text);
  font-size: 1rem; /* below 16 px a phone zooms in on focus */
}

.form-control:focus {
  background-color: var(--sm-bg);
  border-color: var(--sm-accent);
  box-shadow: 0 0 0 0.25rem var(--sm-focus);
  color: var(--sm-text);
}

.form-control::placeholder {
  color: var(--sm-muted);
}

.sm-code {
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
}

/* W6c: the platform's IBAN on «Плата за доступ». Its 29 characters in the
   login code's spacing (.sm-code) ran the page out to 893 px at 375 — found
   on the walk-through, held by test_web_support's
   test_the_fee_page_and_a_moderators_bar_fit_a_phone. Here the letters stay
   a little apart and wrap inside the panel on a narrower screen; the spacing
   is the page's, so a copy carries the IBAN as written. */
.sm-iban {
  font-weight: 600;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

/* W7: «Перевірений виконавець» (V1 §10) — a mark in the accent's outline,
   not a filled button: it says who the person is, it is not a control. */
.sm-verified {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--sm-accent);
  border-radius: 999px;
  color: var(--sm-accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* W7: a review's stars — the accent, in the glyphs; the words beside them
   are for the screen reader (`tutors/_stars.html`). */
.sm-stars {
  color: var(--sm-accent);
  letter-spacing: 0.1em;
}

/* W7: «Новий» — neutral, the point of it (V1 §10): no colour that reads as
   good or bad. «Новий замовник» on a student reads the same. */
.sm-new {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* W7: a review's five stars to choose from — five buttons in a row under a
   finger (rules-frontend §1), which fit 375 px with room to spare. */
.sm-rating {
  display: flex;
  gap: 0.5rem;
}

.sm-rating .btn {
  flex: 1 1 0;
  min-width: 0;
}

/* W7: the landing page's blocks — the restrained register, more air between
   them (rules-frontend §5); the same components as everywhere else. */
.sm-landing {
  margin-bottom: 1.75rem;
}

/* W7: the counters by work type — a plain list, one line each. */
.sm-types {
  padding-left: 1.1rem;
}

/* W7, from W6c's review: a value a tutor pastes into a banking app — the
   IBAN, the amount, the purpose. Copied by its button where scripts run;
   without them a long press selects it whole. */
.sm-copyable {
  display: block;
  user-select: all;
  -webkit-user-select: all;
}

/* The four buttons (V1 §18): primary filled, secondary outlined, text, and
   red for what cannot be undone — and for nothing else. */
.btn-primary {
  --bs-btn-bg: var(--sm-accent);
  --bs-btn-border-color: var(--sm-accent);
  --bs-btn-color: var(--sm-on-accent);
  --bs-btn-hover-bg: var(--sm-accent-hover);
  --bs-btn-hover-border-color: var(--sm-accent-hover);
  --bs-btn-hover-color: var(--sm-on-accent);
  --bs-btn-active-bg: var(--sm-accent-hover);
  --bs-btn-active-border-color: var(--sm-accent-hover);
  --bs-btn-active-color: var(--sm-on-accent);
  --bs-btn-disabled-bg: var(--sm-accent);
  --bs-btn-disabled-border-color: var(--sm-accent);
  --bs-btn-disabled-color: var(--sm-on-accent);
  --bs-btn-focus-shadow-rgb: none;
}

.btn-outline-primary {
  --bs-btn-color: var(--sm-accent);
  --bs-btn-border-color: var(--sm-accent);
  --bs-btn-hover-bg: var(--sm-accent);
  --bs-btn-hover-border-color: var(--sm-accent);
  --bs-btn-hover-color: var(--sm-on-accent);
  --bs-btn-active-bg: var(--sm-accent);
  --bs-btn-active-border-color: var(--sm-accent);
  --bs-btn-active-color: var(--sm-on-accent);
}

/* A plain link in the page takes the accent too — Bootstrap's own blue is not
   a theme colour, and on the dark surface it all but disappears (found in
   W3's walk-through, on a requirement file's name). Scoped to the page: the
   bar's links keep their own colour. */
.sm-main a:not(.btn) {
  color: var(--sm-accent);
}

.sm-main a:not(.btn):hover {
  color: var(--sm-accent-hover);
}

/* A fieldset's legend read as a field's label, not as a heading. */
legend.form-label {
  font-size: 1rem;
}

.btn-link {
  --bs-btn-color: var(--sm-accent);
  --bs-btn-hover-color: var(--sm-accent-hover);
  --bs-btn-active-color: var(--sm-accent-hover);
}

.btn-danger {
  --bs-btn-bg: var(--sm-danger);
  --bs-btn-border-color: var(--sm-danger);
  --bs-btn-color: var(--sm-on-danger);
  --bs-btn-hover-bg: var(--sm-danger-hover);
  --bs-btn-hover-border-color: var(--sm-danger-hover);
  --bs-btn-hover-color: var(--sm-on-danger);
  --bs-btn-active-bg: var(--sm-danger-hover);
  --bs-btn-active-border-color: var(--sm-danger-hover);
  --bs-btn-active-color: var(--sm-on-danger);
}

.btn:focus-visible {
  box-shadow: 0 0 0 0.25rem var(--sm-focus);
}

/* On a phone the bar is two rows by design: the brand and the menu, then the
   daily sections as tabs — three links and a button do not fit 375 px in one.
   From 576 px they share one row. */
.sm-bar .sm-container {
  flex-wrap: wrap;
}

/* W6c: a moderator's tabs are four and the bell, and since #34 the bell
   carries a count — at 1.25rem apart the count ran past a 375 px screen's
   edge (found on the walk-through; test_web_support's
   test_the_fee_page_and_a_moderators_bar_fit_a_phone). On a phone the tabs
   sit 1rem apart, and if a row still does not fit — a chat's count beside the
   bell's — the bell wraps rather than run off the screen. From 576 px, as
   before. */
.sm-bar-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1rem;
  order: 3;
  width: 100%;
}

.sm-menu-button {
  order: 2;
  margin-left: auto;
}

@media (min-width: 576px) {
  .sm-bar-links {
    order: 0;
    width: auto;
    flex-wrap: nowrap;
    column-gap: 1.25rem;
    margin-left: auto;
    margin-right: 0.75rem;
  }

  .sm-menu-button {
    margin-left: 0;
  }
}

.sm-bar-link {
  color: var(--sm-text);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.sm-bar-link:hover,
.sm-bar-link:focus-visible {
  color: var(--sm-accent);
}

.sm-card {
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.sm-card h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sm-state {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

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

.sm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sm-row > form {
  flex: 1 1 10rem;
}

.sm-section {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
}

.sm-notice {
  background: var(--sm-surface);
  border: 1px solid var(--sm-danger);
  border-radius: 0.75rem;
  color: var(--sm-text);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.sm-file {
  border: 1px solid var(--sm-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.sm-description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.form-select {
  background-color: var(--sm-bg);
  border-color: var(--sm-border);
  color: var(--sm-text);
  font-size: 1rem;
  min-height: 2.75rem;
}

.sm-menu-button {
  border: 1px solid var(--sm-border);
  min-width: 2.75rem;
}

.sm-menu {
  background: var(--sm-bg);
  color: var(--sm-text);
}

/* The hamburger drawn from the text colour: Bootstrap's toggler icon is an SVG
   with a fixed dark stroke, invisible in the dark theme. */
.sm-burger,
.sm-burger::before,
.sm-burger::after {
  background: var(--sm-text);
  border-radius: 1px;
  display: block;
  height: 2px;
  width: 1.25rem;
}

.sm-burger {
  position: relative;
}

.sm-burger::before,
.sm-burger::after {
  content: "";
  left: 0;
  position: absolute;
}

.sm-burger::before {
  top: -6px;
}

.sm-burger::after {
  top: 6px;
}

/* The bell (V1 §18, W4): an icon drawn from the text colour, and the unread
   count on it. */
.sm-bell {
  position: relative;
  padding: 0 0.25rem;
}

.sm-badge {
  background: var(--sm-accent);
  border-radius: 1rem;
  color: var(--sm-on-accent);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  min-width: 1.25rem;
  padding: 0.2rem 0.35rem;
  position: absolute;
  right: -0.4rem;
  text-align: center;
  top: 0.2rem;
}

/* The payment screen (V1 §18) — the restrained register: more air. The 30
   minutes are the sharpest deadline in the system and look unlike the rest
   (V1 §14): an accent border, the time in bold. */
.sm-deadline {
  border: 2px solid var(--sm-accent);
  border-radius: 0.75rem;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}

.sm-facts dt {
  color: var(--sm-muted);
  font-weight: 400;
  margin-top: 0.75rem;
}

.sm-facts dd {
  margin-bottom: 0;
}

.sm-amount {
  font-size: 1.5rem;
  font-weight: 600;
}

/* The card number: large, in fixed-width digits, selected whole by one long
   press on a phone — and copied by the button beside it where scripts run. */
.sm-card-number {
  display: block;
  font-family: var(--bs-font-monospace);
  font-size: 1.4rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  user-select: all;
  -webkit-user-select: all;
}

.sm-steps {
  padding-left: 1.25rem;
}

.sm-steps li {
  margin-bottom: 0.35rem;
}

/* The tab: each notice a full-width button — clicking it is what reads it
   (V1 §18) — and the unread ones in bold with a mark. */
.sm-notice-item {
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: 0.75rem;
  color: var(--sm-text);
  display: block;
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  text-align: left;
  width: 100%;
}

.sm-notice-item:hover,
.sm-notice-item:focus-visible {
  border-color: var(--sm-accent);
}

.sm-notice-item.sm-unread {
  border-left: 4px solid var(--sm-accent);
  font-weight: 600;
}

.sm-notice-item .sm-muted {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  margin-top: 0.25rem;
}

/* Bootstrap's close button is a black glyph; in the dark it is turned light,
   as Bootstrap's own dark mode does. */
@media (prefers-color-scheme: dark) {
  :root:not([data-sm-surface="public"]) .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
  }
}

/* The file picker (W4's review, `templates/_file_picker.html`): the label is
   the button, in the page's words, once `files.js` has run; until then — and
   with scripts off — the browser's own control is the one shown. The input is
   hidden visually, never removed: it stays in the form, focusable, and the
   button shows its focus. */
.sm-file-picker {
  position: relative;
}

.sm-file-picker .sm-file-button {
  display: none;
}

.sm-file-picker.sm-enhanced .sm-file-button {
  display: block;
}

.sm-file-picker.sm-enhanced .sm-file-input {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.sm-file-picker.sm-enhanced:focus-within .sm-file-button {
  box-shadow: 0 0 0 0.25rem var(--sm-focus);
}

.sm-file-chosen {
  margin-top: 0.5rem;
  overflow-wrap: anywhere;
}

/* The chat (W5a). A message is a bordered block — the dark theme separates by
   a border, never a shadow (rules-frontend §2); one's own sits on the
   surface tone. A file is a row a finger can hit: its name, then its type and
   size, before the download (V1 §15). */
.sm-chat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.sm-message {
  border: 1px solid var(--sm-border);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  max-width: 92%;
}

.sm-message.sm-mine {
  align-self: flex-end;
  background: var(--sm-surface);
}

.sm-message-head {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.sm-message-body {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.sm-attachment {
  border-top: 1px solid var(--sm-border);
  display: block;
  margin-top: 0.5rem;
  min-height: 44px;
  padding-top: 0.5rem;
}

.sm-attachment-name {
  display: block;
  overflow-wrap: anywhere;
}

.sm-attachment .sm-muted {
  display: block;
  font-size: 0.875rem;
}

.sm-chat-card {
  color: inherit;
  display: block;
  text-decoration: none;
}

.sm-chat-card .sm-muted {
  display: block;
  font-size: 0.875rem;
}

.sm-chat-card-title {
  display: block;
  font-weight: 600;
}

.sm-badge.sm-badge-inline {
  margin-left: 0.35rem;
  position: static;
  vertical-align: middle;
}

/* W6a — Р-230. The warning before a message that looks like a contact is
   sent: a caution, in the sender's own chat, not an error. */
.sm-caution {
  background: var(--sm-surface);
  border: 1px solid var(--sm-warning);
  border-radius: 0.75rem;
  color: var(--sm-text);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* The same message as the moderator sees it on the case page: flagged. */
.sm-flagged {
  border-left: 3px solid var(--sm-warning);
}

.sm-flag {
  color: var(--sm-warning);
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

/* W8b (Р-233): the closed test's line, on every page above the bar — the
   caution colour, the page's own background for its text, so it reads in
   both themes. */
.sm-test-mode {
  background: var(--sm-warning);
  color: var(--sm-bg);
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-align: center;
}
