/* OCR-B Size I (ANSI X3.49 / ISO 1073-2) — як на паспортах і ID; GPL, bcssupp0rt/ocrbfont */
@font-face {
  font-family: "OCR-B";
  src: url("/static/fonts/OCR-B.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* Токени дизайн-системи — у css/tokens.css (підключається першим).
   Тут лишаються лише локальні аліаси для зворотної сумісності. */
:root {
  --mono: var(--font-mono);
  --mrz-font: var(--font-mrz);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh-base);
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: min(96vw, 1440px);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.container.container--wide {
  max-width: min(98vw, 1680px);
}

.container.container--app-shell {
  display: flex;
  flex-direction: column;
  max-width: min(100vw, 1920px);
  min-height: 100dvh;
  padding-bottom: 0.75rem;
}

.container.container--app-shell > .app-header {
  flex-shrink: 0;
}

.container.container--app-shell > .panel {
  display: none;
}

.container.container--app-shell > .panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.panel.panel--shell {
  background: transparent;
  border: none;
  padding: 0;
}

.panel.panel--shell .app-panel-workspace {
  flex: 1;
  min-height: 0;
}

.app-panel-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.app-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem 1.25rem;
}

.app-content-well {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

.app-content-well--wide {
  max-width: min(100%, 1600px);
}

#calendar-panel .app-content-well--wide {
  max-width: min(100%, 1140px);
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.app-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.app-user-label {
  color: var(--muted);
  font-size: 0.9rem;
}

header h1 {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  line-height: var(--lh-tight);
}

.brand-logo {
  width: 1.05em;
  height: 1.05em;
  margin-right: 0.45rem;
  vertical-align: -0.16em;
  flex-shrink: 0;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-base);
}

/* —— Header & burger drawer —— */
.app-header-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  margin-top: 0.15rem;
  padding: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.burger-btn:hover {
  border-color: var(--text-subtle);
  background: var(--surface-2);
}

.burger-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 1px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 90;
}

.drawer-backdrop.hidden {
  display: none;
}

.app-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 88vw);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  padding: 0;
}

.app-drawer.is-open {
  transform: translateX(0);
}

.app-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.app-drawer-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
}

.app-drawer-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
}

.app-drawer-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.app-drawer-list li {
  margin: 0;
}

.drawer-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.drawer-link:hover {
  background: var(--surface-2);
}

.drawer-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.panel.active {
  display: block;
}

.panel.panel--flat {
  background: transparent;
  border: none;
  padding: 0;
}

.field {
  margin-bottom: 1rem;
}

.field.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

label {
  display: block;
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text);
}

.field.row label {
  margin-bottom: 0;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 0 0.75rem;
  height: var(--control-h);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7076' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2.25rem;
}

.field.row select {
  width: auto;
  min-width: 220px;
}

textarea {
  height: auto;
  min-height: 5rem;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  line-height: var(--lh-base);
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.form-grid .full {
  grid-column: 1 / -1;
}

button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h-sm);
  padding: 0 1.25rem;
  background: var(--btn-primary);
  color: var(--btn-primary-text);
  border: 1px solid var(--btn-primary);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

button.primary:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
}

button.primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

button.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary:disabled:hover {
  background: var(--btn-primary);
  border-color: var(--btn-primary);
}

button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-h-sm);
  padding: 0 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  font-family: inherit;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

button.secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-subtle);
}

button.secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.result {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.result.hidden {
  display: none;
}

.status {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  margin-bottom: var(--space-3);
}

.status.valid {
  color: var(--success);
}

.status.invalid {
  color: var(--error);
}

.mrz-output,
.mrz-document-zone {
  font-family: var(--mrz-font);
  font-weight: normal;
  font-style: normal;
  font-synthesis: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: geometricPrecision;
}

.mrz-output {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  word-break: break-all;
  line-height: 1.8;
}

/* MRZ у макеті документа (для сканування Regula з екрана) */
.mrz-document-card {
  --mrz-chars: 36;
  --mrz-doc-fill: #dce8f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  margin: calc(1.25rem + 30px) auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #9eb8d4;
  background: var(--mrz-doc-fill);
}

.mrz-document-viz {
  flex: 1 1 auto;
  width: 100%;
  min-height: 96px;
  background: var(--mrz-doc-fill);
}

.mrz-document-mrz-band {
  container-type: inline-size;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 12px 10px;
  box-sizing: border-box;
  background: var(--mrz-doc-fill);
  overflow: hidden;
}

.mrz-document-zone {
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: transparent;
  color: #000;
  font-size: 16px;
  line-height: 1.1;
  white-space: pre;
  text-align: center;
  overflow: hidden;
  border: none;
  user-select: all;
}

#generate-result > .status {
  margin-bottom: 0.5rem;
}

#generate-result #copy-btn {
  position: relative;
  z-index: 2;
  margin-top: 0.75rem;
}

/* Пропорції за типом документа */
.mrz-document-card--TD3 {
  --mrz-chars: 44;
  width: 100%;
  max-width: 600px;
  min-height: 285px;
}

.mrz-document-card--TD3 .mrz-document-viz {
  min-height: 132px;
}

.mrz-document-card--TD3 .mrz-document-mrz-band {
  min-height: 98px;
  padding: 14px 10px;
}

.mrz-document-card--TD2 {
  --mrz-chars: 36;
  width: 100%;
  max-width: 520px;
  min-height: 265px;
}

.mrz-document-card--TD2 .mrz-document-viz {
  min-height: 110px;
}

.mrz-document-card--TD2 .mrz-document-mrz-band {
  min-height: 96px;
  padding: 12px 10px;
}

.mrz-document-card--TD1 {
  --mrz-chars: 30;
  width: 100%;
  max-width: 480px;
  min-height: 275px;
}

.mrz-document-card--TD1 .mrz-document-viz {
  min-height: 105px;
}

.mrz-document-card--TD1 .mrz-document-mrz-band {
  min-height: 92px;
  padding: 12px 8px;
}

@media (min-width: 480px) {
  .mrz-document-card--TD3 {
    min-height: 310px;
  }

  .mrz-document-card--TD2 {
    min-height: 290px;
  }

  .mrz-document-card--TD1 {
    min-height: 300px;
  }

  .mrz-document-card--TD1 .mrz-document-mrz-band {
    min-height: 5.5em;
  }
}

table.fields {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

table.fields th,
table.fields td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

table.fields th {
  width: 40%;
  color: var(--muted);
  font-weight: 600;
}

.errors-list,
.warnings-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.errors-list li {
  color: var(--error);
}

.warnings-list li {
  color: var(--warning);
}

.hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--lh-base);
}

.section-title {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.badge.valid {
  background: var(--success-bg);
  color: var(--success);
}

.badge.invalid {
  background: var(--error-bg);
  color: var(--error);
}

.badge.neutral {
  background: var(--surface-2);
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Маскування секретних полів без type="password" —
   щоб менеджер паролів браузера не плутав їх із обліковим паролем. */
.secret-input {
  -webkit-text-security: disc;
  text-security: disc;
  font-family: var(--font-ui);
  letter-spacing: 0.15em;
}

.secret-input:placeholder-shown {
  letter-spacing: normal;
}

.field-with-action {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.field-with-action input,
.field-with-action select {
  flex: 1;
  min-width: 0;
}

.field-with-action button.secondary {
  flex-shrink: 0;
  align-self: stretch;
  white-space: nowrap;
}

.national-id-panel {
  margin-bottom: 1rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.national-id-preview {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
}

.national-id-preview dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

.national-id-preview dt {
  color: var(--muted);
  font-weight: 600;
}

input.readonly-field,
select.readonly-field {
  background: var(--surface-2);
  color: var(--text-muted);
}

.hint.stale {
  color: var(--warning);
  font-weight: 600;
}

.document-sample-panel {
  margin-bottom: 1rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.document-sample-figure {
  margin: 0;
  text-align: center;
}

.document-sample-figure img {
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
}

.document-sample-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.document-sample-figure a {
  color: var(--primary);
}

/* Standalone national ID tab */
.panel-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0 1.25rem;
}

#standalone-nat-result .national-id-preview,
#standalone-nat-validate-result {
  margin-top: 0.75rem;
}

/* Year calendar */
.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
}

.calendar-year-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0;
}

.calendar-year-form label {
  margin: 0;
  font-weight: 600;
}

.calendar-year-form input[type="number"] {
  width: 5.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.calendar-year-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.88rem;
}

.calendar-year-nav a {
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.calendar-year-nav a:hover {
  text-decoration: underline;
}

.calendar-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
}

.calendar-main {
  --cal-month-width: 228px;
  --cal-holiday-si: var(--cal-si);
  --cal-holiday-ro: var(--cal-ro);
  --cal-holiday-hr: var(--cal-hr);
  --cal-holiday-bg: var(--cal-bg);
  --cal-holiday-ring-si: var(--cal-si-ring);
  --cal-holiday-ring-ro: var(--cal-ro-ring);
  --cal-holiday-ring-hr: var(--cal-hr-ring);
  --cal-holiday-ring-bg: var(--cal-bg-ring);
  flex: 0 1 auto;
  width: 100%;
  max-width: calc(var(--cal-month-width) * 3 + 2.5rem);
  min-width: 0;
}

.calendar-holidays-aside {
  flex: 0 0 min(300px, 100%);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  position: sticky;
  top: 1rem;
}

.calendar-holidays-unavailable {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}

.calendar-holidays-unavailable.hidden {
  display: none;
}

.calendar-layout.calendar-holidays-off .calendar-holidays-active,
.calendar-layout.calendar-holidays-off .calendar-holiday-legend {
  display: none;
}

.calendar-selected-date {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
}

.calendar-selected-date.is-today {
  color: var(--primary);
}

.calendar-holidays-aside > .section-title:first-of-type {
  margin-top: 0;
}

.calendar-country-divider {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.calendar-country-today-date {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.calendar-country-today-status {
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
}

.calendar-country-today-status.none {
  color: var(--muted);
}

.calendar-country-today-status.yes {
  color: var(--success);
}

.calendar-country-today-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.92rem;
}

.calendar-holiday-legend {
  margin: 0.75rem 0 0;
  text-align: center;
}

.legend-holiday {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 2px;
}

.legend-holiday-si {
  background: var(--cal-holiday-si);
  border: 1px solid var(--cal-holiday-ring-si);
}

.legend-holiday-ro {
  background: var(--cal-holiday-ro);
  border: 1px solid var(--cal-holiday-ring-ro);
}

.legend-holiday-hr {
  background: var(--cal-holiday-hr);
  border: 1px solid var(--cal-holiday-ring-hr);
}

.legend-holiday-bg {
  background: var(--cal-holiday-bg);
  border: 1px solid var(--cal-holiday-ring-bg);
}

.legend-holiday-multi {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  vertical-align: middle;
  border-radius: 2px;
  background: conic-gradient(
    from -45deg,
    var(--cal-holiday-si) 0deg 89deg,
    #fff 89deg 91deg,
    var(--cal-holiday-ro) 91deg 180deg,
    #fff 180deg 182deg,
    var(--cal-holiday-hr) 182deg 271deg,
    #fff 271deg 273deg,
    var(--cal-holiday-bg) 273deg 362deg
  );
  border: 1px solid var(--border);
}

.calendar-year-title {
  margin: 0 0 1rem;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  text-align: center;
}

.calendar-year-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--cal-month-width));
  justify-content: center;
  gap: 1rem 1.1rem;
}

.calendar-month {
  width: var(--cal-month-width);
  max-width: 100%;
  margin: 0 auto;
  font-size: 0.82rem;
  line-height: 1.35;
}

.calendar-month-name {
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.35rem;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.calendar-weekdays span.weekend {
  color: var(--error);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  gap: 1px 0;
}

.calendar-day {
  padding: 0.12rem 0;
  font-size: 0.8rem;
}

.calendar-day.selectable {
  cursor: pointer;
}

.calendar-day.selectable:hover {
  outline: 1px solid var(--primary);
  outline-offset: -1px;
}

.calendar-day.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

.calendar-day.empty {
  visibility: hidden;
}

.calendar-day.weekend {
  color: var(--error);
}

.calendar-day.today {
  background: var(--error);
  color: #fff;
  border-radius: 2px;
  font-weight: 700;
}

.calendar-day.holiday-si {
  background: var(--cal-holiday-si);
  color: var(--cal-si-ink);
  border-radius: 2px;
  font-weight: var(--fw-semibold);
}

.calendar-day.holiday-ro {
  background: var(--cal-holiday-ro);
  color: var(--cal-ro-ink);
  border-radius: 2px;
  font-weight: var(--fw-semibold);
}

.calendar-day.today.holiday-si {
  box-shadow: inset 0 0 0 2px var(--cal-holiday-ring-si);
}

.calendar-day.today.holiday-ro {
  box-shadow: inset 0 0 0 2px var(--cal-holiday-ring-ro);
}

.calendar-day.holiday-hr {
  background: var(--cal-holiday-hr);
  color: var(--cal-hr-ink);
  border-radius: 2px;
  font-weight: var(--fw-semibold);
}

.calendar-day.today.holiday-hr {
  box-shadow: inset 0 0 0 2px var(--cal-holiday-ring-hr);
}

.calendar-day.holiday-bg {
  background: var(--cal-holiday-bg);
  color: var(--cal-bg-ink);
  border-radius: 2px;
  font-weight: var(--fw-semibold);
}

.calendar-day.today.holiday-bg {
  box-shadow: inset 0 0 0 2px var(--cal-holiday-ring-bg);
}

.calendar-day.holiday-multi {
  color: #1f2937;
  border-radius: 2px;
  font-weight: 700;
  text-shadow: 0 0 1px #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
}

.calendar-day.today.holiday-multi:not([style*="box-shadow"]) {
  box-shadow: inset 0 0 0 2px var(--primary);
}

@media (max-width: 900px) {
  .calendar-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-main {
    max-width: calc(var(--cal-month-width) * 2 + 1.1rem);
    margin: 0 auto;
  }

  .calendar-holidays-aside {
    flex: none;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: static;
  }

  .calendar-year-grid {
    grid-template-columns: repeat(2, var(--cal-month-width));
  }
}

@media (max-width: 520px) {
  .calendar-main {
    max-width: var(--cal-month-width);
  }

  .calendar-year-grid {
    grid-template-columns: var(--cal-month-width);
  }
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.row {
    flex-direction: column;
    align-items: stretch;
  }

  .field.row select {
    width: 100%;
  }
}

/* —— Stickers —— */
.stickers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stickers-toolbar-filters {
  display: flex;
  gap: 0.35rem;
}

.stickers-filter {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.stickers-filter:hover {
  background: var(--surface-2);
  color: var(--text);
}

.stickers-filter.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.stickers-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

#stickers-panel .stickers-toolbar {
  flex-shrink: 0;
}

#stickers-panel .stickers-workspace {
  flex: 1;
  min-height: 0;
}

.stickers-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stickers-zone {
  flex: 1 1 50%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stickers-zone--mine {
  border-right: 1px solid var(--border);
}

.stickers-zone-head {
  flex-shrink: 0;
  padding: 0.65rem 0.85rem 0.35rem;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(216, 221, 230, 0.85);
}

.stickers-zone-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
}

.stickers-zone-empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  margin: 0;
  pointer-events: none;
  font-size: 0.92rem;
}

.stickers-workspace--single {
  flex-direction: column;
}

.stickers-zone--full {
  flex: 1;
  min-height: 0;
}

.stickers-workspace--grid .stickers-zone-canvas {
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
}

.stickers-content-well {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.stickers-workspace--grid:not(.stickers-workspace--single) .stickers-content-well {
  max-width: min(100%, 640px);
}

.stickers-workspace--grid .stickers-board:not(.stickers-board--canvas) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 260px));
  justify-content: center;
  gap: 0.85rem;
  align-items: start;
  width: 100%;
}

.stickers-workspace--grid:not(.stickers-workspace--single) .stickers-board:not(.stickers-board--canvas) {
  max-width: min(100%, 640px);
  margin-left: auto;
  margin-right: auto;
}

.stickers-workspace--grid .stickers-zone-empty {
  padding: 2rem 1.5rem;
}

#stickers-sent-layout.hidden,
#stickers-inbox-layout.hidden {
  display: none;
}

.stickers-section-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.stickers-section .stickers-empty {
  padding: 1.25rem 0.75rem;
  margin-bottom: 0.5rem;
}

.sticker-from-label {
  margin: -0.25rem 0 0.75rem;
}

.sticker-card-from,
.sticker-card-to {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.sticker-card-from {
  background: var(--accent-soft);
  color: var(--accent);
}

.sticker-card-to {
  background: var(--success-bg);
  color: var(--success);
}

.stickers-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.stickers-board--canvas {
  display: block;
  position: absolute;
  inset: 0;
  min-height: 0;
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.stickers-board--canvas .sticker-card {
  position: absolute;
  margin: 0;
  min-height: 120px;
  cursor: default;
}

.stickers-board--canvas .sticker-card.is-dragging {
  z-index: 20;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  opacity: 0.96;
}

.stickers-board--canvas .sticker-card.is-resizing {
  z-index: 21;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
}

.sticker-card-drag-handle {
  height: 10px;
  margin: -0.85rem -0.9rem 0.5rem;
  border-radius: 6px 6px 0 0;
  background: rgba(0, 0, 0, 0.08);
  cursor: grab;
  touch-action: none;
}

.sticker-card-drag-handle:active {
  cursor: grabbing;
}

@media (max-width: 900px) {
  .stickers-workspace:not(.stickers-workspace--single) {
    flex-direction: column;
  }

  .stickers-zone--mine {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stickers-workspace:not(.stickers-workspace--single) .stickers-zone {
    flex: 1 1 50%;
    min-height: 220px;
  }
}

.sticker-card {
  position: relative;
  padding: 0.85rem 0.9rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--sticker-border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 120px;
}

.sticker-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.sticker-card.is-locked {
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35) 0%,
    transparent 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
}

.sticker-card.is-locked .sticker-card-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #475569;
}

.sticker-card-body--locked {
  font-style: italic;
  color: #64748b;
  font-size: 0.82rem;
}

.sticker-card-lock-badge {
  position: absolute;
  top: 0.38rem;
  left: 0.42rem;
  color: #64748b;
  opacity: 0.85;
  line-height: 0;
}

.sticker-card.has-password .sticker-card-title {
  padding-left: 1.1rem;
}

.sticker-card-action--lock:hover {
  color: #475569;
  background: rgba(0, 0, 0, 0.08);
}

.sticker-unlock-error {
  color: #b91c1c;
  margin: 0 0 0.5rem;
}

.sticker-card.is-done {
  opacity: 0.72;
}

.sticker-card.is-done .sticker-card-title {
  text-decoration: line-through;
}

.sticker-card.priority-urgent {
  box-shadow: 0 0 0 2px var(--error), var(--shadow-md);
}

.sticker-card.priority-high {
  box-shadow: 0 0 0 2px var(--warning), var(--shadow-sm);
}

.sticker-card.is-overdue:not(.is-done) {
  animation: sticker-pulse 2s ease-in-out infinite;
}

@keyframes sticker-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--error); }
  50% { box-shadow: 0 0 0 3px var(--error), 0 0 12px var(--error-bg); }
}

.sticker-card.color-lemon { background: var(--sticker-lemon); }
.sticker-card.color-mint { background: var(--sticker-mint); }
.sticker-card.color-sky { background: var(--sticker-sky); }
.sticker-card.color-rose { background: var(--sticker-rose); }
.sticker-card.color-lavender { background: var(--sticker-lavender); }
.sticker-card.color-sand { background: var(--sticker-sand); }

.sticker-card-pin {
  position: absolute;
  top: 0.4rem;
  right: 6rem;
  font-size: 0.75rem;
  opacity: 0.65;
}

.sticker-card-title {
  margin: 0 0 0.35rem;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  padding-right: 6.4rem;
  word-break: break-word;
}

.sticker-card-body {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--sticker-ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.sticker-card-tasks {
  margin: 0.45rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sticker-card-task {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #334155;
}

.sticker-card-task input[type="checkbox"] {
  width: auto;
  margin-top: 0.1rem;
}

.sticker-card-task-text {
  line-height: 1.35;
  word-break: break-word;
}

.sticker-card-task.is-done .sticker-card-task-text {
  text-decoration: line-through;
  opacity: 0.72;
}

.sticker-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
  font-size: 0.75rem;
}

.sticker-card-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.15rem;
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  opacity: 0.72;
  transition: opacity 0.18s ease;
}

.sticker-card:hover .sticker-card-actions,
.sticker-card:focus-within .sticker-card-actions {
  opacity: 1;
}

.sticker-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: rgba(15, 23, 42, 0.42);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.sticker-card-action:hover {
  color: rgba(15, 23, 42, 0.72);
  background: rgba(0, 0, 0, 0.06);
}

.sticker-card-action:active {
  transform: scale(0.92);
}

.sticker-card-action-icon {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  pointer-events: none;
}

.sticker-card-action--done:hover {
  color: #15803d;
  background: rgba(22, 163, 74, 0.12);
}

.sticker-card-action--done.is-active {
  color: #15803d;
}

.sticker-card-action--done.is-active:hover {
  color: #166534;
  background: rgba(22, 163, 74, 0.16);
}

.sticker-card-action--delete:hover {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.1);
}

.sticker-card-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 42%, rgba(15, 23, 42, 0.42) 42%, rgba(15, 23, 42, 0.42) 56%, transparent 56%),
    linear-gradient(135deg, transparent 64%, rgba(15, 23, 42, 0.42) 64%, rgba(15, 23, 42, 0.42) 78%, transparent 78%);
  cursor: nwse-resize;
  opacity: 0.58;
}

.sticker-card:hover .sticker-card-resize-handle,
.sticker-card.is-resizing .sticker-card-resize-handle {
  opacity: 0.9;
}

@media (hover: none) {
  .sticker-card-actions {
    opacity: 1;
  }
}

.stickers-board--canvas .sticker-card:hover {
  transform: none;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.sticker-badge {
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  font-weight: var(--fw-medium);
}

.sticker-badge.priority-urgent { background: var(--error-bg); color: var(--error); }
.sticker-badge.priority-high { background: var(--warning-bg); color: var(--warning); }
.sticker-badge.deadline-overdue { background: var(--error-bg); color: var(--error); }
.sticker-badge.deadline-soon { background: var(--warning-bg); color: var(--warning); }

.sticker-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(560px, 94vw);
  max-width: 94vw;
  box-shadow: var(--shadow-lg);
}

.sticker-dialog::backdrop {
  background: rgba(20, 22, 26, 0.4);
}

.sticker-dialog form {
  padding: 1.1rem 1.25rem 1.25rem;
}

.sticker-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sticker-dialog-header h2 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}

.sticker-dialog-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.sticker-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Блок дат: «Дедлайн» і «Нагадати о» — одне під одним, на всю ширину */
.sticker-form-row--datetime {
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.sticker-datetime-field .field-label {
  display: block;
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text);
}

.sticker-datetime-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
}

.sticker-date-input {
  flex: 1 1 auto;
  min-width: 0;
}

/* hh:mm як єдиний згрупований контрол з однією рамкою */
.sticker-time-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: var(--control-h);
  padding: 0 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sticker-time-controls:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.sticker-time-controls input.sticker-time-input {
  width: 1.9rem;
  min-width: 1.9rem;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.sticker-time-controls input.sticker-time-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.sticker-time-sep {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-md);
  color: var(--text-subtle);
  user-select: none;
  padding: 0 0.05rem;
}

.sticker-datetime-clear {
  flex: 0 0 auto;
  width: var(--control-h);
  min-width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  min-height: 0;
  font-size: var(--fs-md);
  color: var(--text-muted);
}

/* —— Sticker dialog: секції, лічильники —— */
.sticker-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.sticker-section-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: var(--space-3);
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.field-head label {
  margin-bottom: var(--space-2);
}

.char-counter {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

/* Колір — кружечки */
.sticker-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.sticker-swatch {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--sticker-border);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.sticker-swatch:hover {
  transform: translateY(-1px);
}

.sticker-swatch.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.sticker-swatch.color-lemon { background: var(--sticker-lemon); }
.sticker-swatch.color-mint { background: var(--sticker-mint); }
.sticker-swatch.color-sky { background: var(--sticker-sky); }
.sticker-swatch.color-rose { background: var(--sticker-rose); }
.sticker-swatch.color-lavender { background: var(--sticker-lavender); }
.sticker-swatch.color-sand { background: var(--sticker-sand); }

/* Пріоритет — сегментований перемикач */
.sticker-priority-seg {
  display: flex;
  gap: var(--space-1);
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sticker-seg-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: calc(var(--radius-sm) - 3px);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.sticker-seg-btn:hover {
  color: var(--text);
}

.sticker-seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.sticker-seg-btn.priority-high.is-active { color: var(--warning); }
.sticker-seg-btn.priority-urgent.is-active { color: var(--error); }

/* Пресети часу */
.sticker-time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

.sticker-preset {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.sticker-preset:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

/* Тоглі-перемикачі */
.sticker-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  cursor: pointer;
  font-size: var(--fs-base);
}

.sticker-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sticker-toggle-track {
  position: relative;
  flex: 0 0 auto;
  width: 2.4rem;
  height: 1.35rem;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  transition: background var(--transition-base);
}

.sticker-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.35rem - 4px);
  height: calc(1.35rem - 4px);
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}

.sticker-toggle input:checked + .sticker-toggle-track {
  background: var(--accent);
}

.sticker-toggle input:checked + .sticker-toggle-track::after {
  transform: translateX(1.05rem);
}

.sticker-toggle input:focus-visible + .sticker-toggle-track {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.sticker-toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sticker-toggle-icon {
  color: var(--text-muted);
}

/* Додатково (details) */
.sticker-advanced {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.sticker-advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.sticker-advanced-summary::-webkit-details-marker {
  display: none;
}

.sticker-advanced-chevron {
  transition: transform var(--transition-base);
}

.sticker-advanced[open] .sticker-advanced-chevron {
  transform: rotate(180deg);
}

.sticker-advanced-body {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sticker-advanced-body .field {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* ============================================================
   Сповіщення — єдиний стек праворуч (вхідний стікер, нагадування,
   пропущені). Однаковий вигляд карток, складаються вниз.
   ============================================================ */
.notif-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  pointer-events: none;
}

.notif-card {
  pointer-events: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.9rem 1rem;
  animation: notif-in 0.25s ease;
}

.notif-card.hidden {
  display: none;
}

.notif-card--incoming {
  border-left-color: var(--accent);
}

.notif-card--missed {
  border-left-color: var(--warning);
}

.notif-card--alarm {
  border-left-color: var(--error);
  animation: notif-in 0.25s ease, notif-pulse 1.6s ease-in-out infinite;
}

.notif-label {
  display: block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.notif-title {
  display: block;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin-bottom: 0.3rem;
}

.notif-body {
  margin: 0 0 0.7rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: pre-wrap;
}

.notif-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.notif-actions .primary,
.notif-actions .secondary {
  flex: 1 1 auto;
  min-width: 6rem;
}

.sticker-alarm-hint {
  margin: 0 0 0.7rem;
  color: var(--text-subtle);
  font-size: var(--fs-xs);
}

.sticker-alarm-snooze {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.sticker-alarm-snooze-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.sticker-alarm-snooze-btn {
  flex: 1 1 auto;
  min-width: 3.5rem;
}

.sticker-alarm-enable-sound {
  flex-basis: 100%;
}

@keyframes notif-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes notif-pulse {
  0%, 100% {
    box-shadow: var(--shadow-lg);
  }
  50% {
    box-shadow: 0 12px 40px rgba(192, 57, 43, 0.35);
  }
}

.sticker-form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.5rem 0;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  margin: 0;
  cursor: pointer;
}

.check-label input {
  width: auto;
}

.sticker-dialog-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.sticker-task-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sticker-task-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.sticker-task-item.done .sticker-task-item-text {
  text-decoration: line-through;
  opacity: 0.7;
}

.sticker-task-item input[type="checkbox"] {
  width: auto;
}

.sticker-task-item-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  font-size: 0.9rem;
}

.sticker-task-remove {
  border: none;
  background: transparent;
  color: #b91c1c;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
}

.sticker-dialog-spacer {
  flex: 1;
}

@media (max-width: 480px) {
  .sticker-form-row {
    grid-template-columns: 1fr;
  }

  .sticker-datetime-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .sticker-time-controls {
    justify-content: center;
  }

  .sticker-datetime-clear {
    width: 100%;
  }
}

/* ============================================================
   JPEG → PDF конвертер
   ============================================================ */
.j2p-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-6) var(--space-4);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-base), background var(--transition-base),
    color var(--transition-base);
}

.j2p-dropzone:hover,
.j2p-dropzone:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.j2p-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.j2p-dropzone-icon {
  color: var(--accent);
}

.j2p-dropzone-title {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--text);
}

.j2p-dropzone-sub {
  margin: 0;
  font-size: var(--fs-sm);
}

.j2p-dropzone-link {
  color: var(--accent);
  text-decoration: underline;
}

.j2p-controls {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.j2p-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}

.j2p-options .field {
  margin: 0;
}

.j2p-options .field.is-disabled {
  opacity: 0.5;
}

.j2p-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.j2p-toolbar-spacer {
  flex: 1 1 auto;
}

.j2p-count {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.j2p-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
}

.j2p-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: grab;
  transition: box-shadow var(--transition-base), border-color var(--transition-base),
    transform var(--transition-base);
}

.j2p-card:hover {
  box-shadow: var(--shadow-md);
}

.j2p-card.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.j2p-card.is-drop-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.j2p-card-num {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 var(--space-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--btn-primary);
  color: var(--btn-primary-text);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.j2p-card-thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.j2p-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.j2p-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2);
  min-width: 0;
}

.j2p-card-name {
  font-size: var(--fs-sm);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.j2p-card-size {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

.j2p-card-actions {
  display: flex;
  gap: var(--space-1);
  padding: 0 var(--space-2) var(--space-2);
}

.j2p-icon-btn {
  flex: 1;
  height: var(--control-h-sm);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast);
}

.j2p-icon-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.j2p-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.j2p-card-remove:hover:not(:disabled) {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.j2p-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.j2p-filename-field {
  flex: 1 1 220px;
  margin: 0;
}

.j2p-filename-input {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.j2p-filename-input input {
  flex: 1;
  min-width: 0;
}

.j2p-filename-ext {
  color: var(--text-subtle);
  font-size: var(--fs-base);
}

.j2p-status.is-error {
  color: var(--error);
}

.j2p-status.is-ok {
  color: var(--success);
}

@media (max-width: 560px) {
  .j2p-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

/* —— PDF → JPEG: картки сторінок —— */
.p2j-card {
  cursor: pointer;
}

.p2j-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.p2j-check {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
  background: var(--surface);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.p2j-card.is-selected .p2j-check {
  border-color: var(--accent);
  background: var(--accent);
}

.p2j-card.is-selected .p2j-check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--text-inverse);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.p2j-thumb {
  aspect-ratio: auto;
  min-height: 120px;
  background: var(--surface-3);
}

.p2j-thumb img {
  object-fit: contain;
}

.p2j-card.is-loading .p2j-thumb {
  position: relative;
  overflow: hidden;
}

.p2j-card.is-loading .p2j-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 70%
  );
  animation: p2j-shimmer 1.1s infinite;
}

@keyframes p2j-shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* ============================================================
   Генератор QR та штрихкодів
   ============================================================ */
.codes-tabs {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.codes-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  padding: 0 var(--space-4);
  min-height: var(--control-h-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.codes-tab:hover {
  color: var(--text);
}

.codes-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.codes-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: var(--space-6);
  align-items: start;
}

.codes-controls {
  min-width: 0;
}

.codes-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.codes-fields .field {
  margin: 0;
}

.codes-format-hint {
  margin-top: var(--space-2);
}

.codes-advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 0 var(--space-4);
}

.codes-advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  list-style: none;
  cursor: pointer;
  padding: var(--space-3) 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
}

.codes-advanced-summary::-webkit-details-marker {
  display: none;
}

.codes-advanced-summary svg {
  color: var(--text-muted);
  transition: transform var(--transition-base);
}

.codes-advanced[open] .codes-advanced-summary svg {
  transform: rotate(180deg);
}

.codes-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

.codes-options .field {
  margin: 0;
}

.codes-color-field input[type="color"] {
  width: 100%;
  height: var(--control-h);
  padding: 0.2rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.codes-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-regular);
  color: var(--text);
  cursor: pointer;
  margin: 0 0 var(--space-4);
}

.codes-toggle input {
  width: auto;
  margin: 0;
}

.codes-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.codes-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%)
    50% / 22px 22px;
}

.codes-canvas {
  max-width: 100%;
  max-height: 420px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.codes-canvas.hidden {
  display: none;
}

.codes-placeholder {
  margin: 0;
  color: var(--text-subtle);
  font-size: var(--fs-sm);
  text-align: center;
}

.codes-error {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error);
  font-size: var(--fs-sm);
}

.codes-error.hidden {
  display: none;
}

.codes-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.codes-filename-field {
  flex: 1 1 180px;
  margin: 0;
}

@media (max-width: 720px) {
  .codes-layout {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}
