:root {
  --bg: #f3f6fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-soft: #eef4ff;
  --text: #162338;
  --muted: #66758d;
  --line: #dfe7f3;
  --primary: #2d7ff0;
  --primary-strong: #1f63c9;
  --primary-soft: #ddebff;
  --success: #198754;
  --danger: #c0392b;
  --shadow: 0 20px 60px rgba(19, 34, 59, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(45, 127, 240, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(29, 122, 214, 0.08), transparent 28%),
    var(--bg);
}

body.app-shell,
body.auth-shell {
  min-height: 100vh;
}

body.auth-shell {
  background:
    radial-gradient(circle at top left, rgba(42, 117, 214, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(61, 104, 161, 0.1), transparent 30%),
    #eef3f9;
}

.app-background,
.auth-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.app-frame {
  position: relative;
  width: min(1540px, calc(100% - 32px));
  margin: 18px auto 28px;
  padding: 22px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 6px 4px 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand--auth {
  margin-bottom: 22px;
}

.brand-mark {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #378af6, #2d7ff0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
}

.brand-mark svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.brand-title {
  font-size: 3rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-subtitle {
  margin-top: 8px;
  font-size: 1.02rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.65);
  min-height: 72px;
}

.top-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 0 22px;
  border-radius: 22px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.top-nav__link.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.user-chip {
  min-width: 180px;
  min-height: 72px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.7);
}

.user-chip__name {
  font-weight: 700;
}

.user-chip__role {
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--muted);
}

.header-actions form {
  margin: 0;
}

.header-actions form .button {
  min-height: 72px;
  border-radius: 28px;
  padding: 0 24px;
}

.content-card,
.auth-card {
  margin-top: 22px;
  padding: 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid rgba(223, 231, 243, 0.9);
}

.auth-card {
  width: min(560px, calc(100% - 32px));
  margin: 8vh auto;
  padding: 38px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(19, 34, 59, 0.14);
}

.auth-shell {
  display: grid;
  place-items: start center;
  padding: 0 16px 32px;
}

.flash {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-weight: 600;
}

.flash--success {
  background: #ecf9f0;
  border-color: #bfe8cb;
  color: var(--success);
}

.flash--error {
  background: #fdecec;
  border-color: #f0c4c4;
  color: var(--danger);
}

.page-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.page-intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-head--split {
  align-items: center;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.report-actions {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(170px, 220px) minmax(170px, 220px);
  gap: 12px;
  align-items: end;
  justify-content: flex-end;
}

.report-actions .inline-form {
  width: 100%;
  margin: 0;
  flex-wrap: nowrap;
}

.report-actions .inline-form .field--inline {
  flex: 1 1 auto;
  min-width: 240px;
}

.report-actions .inline-form .field--inline input[type="month"] {
  min-width: 240px;
}

.report-actions > .button,
.report-actions .inline-form .button {
  width: 100%;
}

.print-dialog {
  width: min(560px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 28px 80px rgba(19, 34, 59, 0.18);
}

.print-dialog::backdrop {
  background: rgba(10, 18, 32, 0.46);
  backdrop-filter: blur(4px);
}

.print-dialog__panel {
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.print-dialog__title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.print-dialog__text {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.print-dialog__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .report-actions {
    grid-template-columns: 1fr;
  }
}

.section-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.inline-form,
.stack-form {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: end;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .button {
  align-self: flex-start;
}

.auth-card .page-title {
  margin-bottom: 4px;
}

.auth-card .field input {
  background: #fff;
  border-color: #d7e0ec;
}

.auth-card .button--primary {
  box-shadow: 0 18px 34px rgba(45, 127, 240, 0.18);
}

.auth-card .flash {
  border-radius: 16px;
  background: #f7faff;
}

.stack-form {
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field > span {
  font-weight: 700;
  font-size: 0.92rem;
}

.field input,
.field select {
  min-height: 52px;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.field input:focus,
.field select:focus,
.count-input:focus {
  outline: none;
  border-color: rgba(45, 127, 240, 0.65);
  box-shadow: 0 0 0 4px rgba(45, 127, 240, 0.12);
}

.field--inline {
  min-width: 280px;
}

.button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-height: 52px;
  padding: 0 20px;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(160deg, #378af6, #2d7ff0);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 16px 32px rgba(45, 127, 240, 0.22);
}

.button--ghost {
  background: #fff;
}

.button--ghost:hover {
  background: #f7fbff;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid--price {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.price-panel--edit .grid--price {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--user {
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
}

.price-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-bottom: 20px;
}

.price-panel {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.price-panel--edit {
  background: linear-gradient(180deg, rgba(241, 248, 255, 0.96), rgba(255, 255, 255, 0.94));
}

.daily-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.daily-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(235, 242, 255, 0.85), rgba(248, 251, 255, 0.85));
  border: 1px solid #dde7f7;
}

.daily-meta__label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.daily-meta__value {
  font-weight: 700;
}

.letter-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.letter-row {
  display: grid;
  grid-template-columns: 104px minmax(220px, 1.1fr) minmax(420px, 1.4fr) 170px;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 28px rgba(20, 37, 64, 0.04);
}

.letter-row__icon {
  width: 104px;
  height: 104px;
  border-radius: 20px;
  display: grid;
  place-items: center;
}

.letter-row__icon svg {
  width: 44px;
  height: 44px;
  fill: currentColor;
}

.letter-row__icon--standard {
  background: #deedff;
  color: #35577d;
}

.letter-row__icon--kompakt {
  background: #d7f4e7;
  color: #35765f;
}

.letter-row__icon--gross {
  background: #e6e2ff;
  color: #61509d;
}

.letter-row__icon--maxi {
  background: #fae8c7;
  color: #8a6c29;
}

.letter-row__icon--pakete {
  background: #ffe3cc;
  color: #aa5f1f;
}

.letter-row__meta {
  min-width: 0;
}

.letter-row__label {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.letter-row__hint {
  color: var(--muted);
  margin-top: 5px;
  font-size: 1rem;
}

.letter-row__controls {
  display: grid;
  grid-template-columns: 88px 1fr 88px;
  gap: 14px;
  align-items: center;
}

.count-btn {
  height: 96px;
  border-radius: 18px;
  border: 1px solid #d7e1ee;
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
  color: #25354d;
  font-size: 3rem;
  font-weight: 500;
  cursor: pointer;
}

.count-btn--primary {
  background: linear-gradient(160deg, #378af6, #2d7ff0);
  color: #fff;
  border-color: transparent;
}

.count-btn--primary.count-btn--standard {
  background: linear-gradient(160deg, #6aa8f7, #4a8fe8);
}

.count-btn--primary.count-btn--kompakt {
  background: linear-gradient(160deg, #6fd0aa, #4ab187);
}

.count-btn--primary.count-btn--gross {
  background: linear-gradient(160deg, #8f80de, #6e5bbd);
}

.count-btn--primary.count-btn--maxi {
  background: linear-gradient(160deg, #e8be62, #c99934);
}

.count-btn--primary.count-btn--pakete {
  background: linear-gradient(160deg, #f2a24a, #d97b14);
}

.count-input-wrap {
  display: block;
}

.count-input {
  width: 100%;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 18px;
  font-size: 2.9rem;
  text-align: center;
  font-weight: 800;
  color: var(--text);
  background: #fff;
}

.letter-row__price {
  justify-self: end;
  min-width: 136px;
  text-align: right;
}

.letter-row__price-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.letter-row__price-value {
  font-size: 1.3rem;
  font-weight: 800;
  margin-top: 4px;
}

.bottom-summary {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #eef4ff, #f7fbff);
  border: 1px solid #dae5f5;
}

.bottom-summary__block {
  padding-right: 18px;
  border-right: 1px solid #c8d6e8;
}

.bottom-summary__block:last-of-type {
  border-right: 0;
  padding-right: 0;
}

.bottom-summary__label,
.summary-card__label {
  color: var(--muted);
  font-size: 0.95rem;
}

.bottom-summary__value,
.summary-card__value {
  margin-top: 5px;
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.bottom-summary__hint {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.95rem;
}

.bottom-summary__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.dirty-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fdecec;
  border: 1px solid #f3c7c3;
  color: #b42318;
  font-weight: 700;
  font-size: 0.92rem;
}

.dirty-pill[hidden] {
  display: none !important;
}

.footnote {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.card-table {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 700;
}

.data-table tfoot th {
  border-top: 2px solid var(--line);
  border-bottom: 0;
}

.data-table--wide {
  table-layout: fixed;
}

.report-row--quiet td {
  background: linear-gradient(180deg, rgba(244, 247, 251, 0.9), rgba(239, 243, 248, 0.9));
  color: #7b8697;
}

.report-row--quiet strong,
.report-row--quiet .table-muted {
  color: #7b8697;
}

.report-row--quiet td:first-child {
  box-shadow: inset 4px 0 0 #d9e1ec;
}

.data-table--wide td,
.data-table--wide th {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.data-table--wide td:first-child,
.data-table--wide th:first-child {
  width: 28%;
}

.data-table--wide td:not(:first-child),
.data-table--wide th:not(:first-child) {
  text-align: center;
}

.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-delete-form {
  margin: 0;
}

.button--compact {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.button--danger {
  background: #ffeceb;
  border-color: #f3c7c3;
  color: #b42318;
}

.button--danger:hover {
  background: #ffdede;
}

.table-muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 255, 0.92));
  border: 1px solid var(--line);
}

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff4d9;
  color: #7d5a09;
  border: 1px solid #f2d691;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media print {
  body {
    background: #fff;
  }

  .app-frame {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .app-header,
  .top-nav,
  .header-actions,
  .button,
  .dirty-pill {
    display: none !important;
  }

  .content-card {
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
  }
}
