:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f9;
  --ink: #1f2937;
  --muted: #667085;
  --line: #d8e0ec;
  --primary: #5e7198;
  --primary-strong: #465a80;
  --primary-soft: #e7edf7;
  --accent: #ef1111;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --shadow: 0 18px 44px rgba(31, 41, 55, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px 16px;
}

.brand-block {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.brand-mark {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.25;
}

.brand-block p {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(94, 113, 152, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 16px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 14px 10px;
  background: rgba(244, 247, 251, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-title img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.header-title h1 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.25;
}

.header-title span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.content {
  display: grid;
  gap: 14px;
  padding: 14px;
  padding-bottom: 32px;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat b {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 14px 10px;
  background: rgba(244, 247, 251, 0.94);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-button,
.segmented button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  padding: 0 12px;
}

.tab-button.active,
.segmented button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.section {
  display: grid;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.84rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 13px;
  color: #fff;
  background: var(--primary);
  font-weight: 650;
  text-decoration: none;
}

.button:hover {
  background: var(--primary-strong);
}

.button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.button.secondary:hover {
  background: var(--surface-soft);
}

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: #b91c1c;
}

.button.good {
  background: var(--ok);
}

.button.info {
  background: var(--info);
}

.money-badge {
  color: #465a80;
  background: var(--primary-soft);
}

.icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.button svg,
.tab-button svg,
.segmented svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.subtle {
  color: var(--muted);
  font-size: 0.86rem;
}

.list {
  display: grid;
  gap: 10px;
}

.card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.05);
}

.card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 750;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity b,
.card-title {
  display: block;
  margin: 0;
  font-size: 0.98rem;
}

.identity span {
  display: block;
  color: var(--muted);
  font-size: 0.83rem;
}

.badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.admin {
  color: #155e75;
  background: #cffafe;
}

.badge.root {
  color: #92400e;
  background: #fef3c7;
}

.badge.worker {
  color: #166534;
  background: var(--ok-soft);
}

.badge.pending,
.badge.postponed {
  color: #92400e;
  background: #fef3c7;
}

.badge.done {
  color: #166534;
  background: var(--ok-soft);
}

.badge.money-badge {
  border-color: rgba(94, 113, 152, 0.18);
}

.badge.canceled {
  color: #991b1b;
  background: var(--danger-soft);
}

.badge.approved {
  color: #166534;
  background: var(--ok-soft);
}

.badge.none {
  color: #3f3f46;
  background: #f4f4f5;
}

.info-grid {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
}

.info-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.info-line svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--primary);
  margin-top: 2px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.assignment-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(278px, 84vw);
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x mandatory;
}

.assignment-column {
  min-height: 280px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  scroll-snap-align: start;
}

.assignment-column.unassigned {
  border-color: #fca5a5;
  background: #fff7f7;
}

.assignment-column-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.assignment-column-head b,
.assignment-column-head strong {
  display: block;
  font-size: 0.98rem;
}

.assignment-column-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.assignment-column-head > div:last-child {
  text-align: left;
}

.assignment-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.assignment-order {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.assignment-order-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
}

.assignment-order-top b,
.assignment-order-top span {
  display: block;
}

.assignment-order-top span {
  color: var(--muted);
  font-size: 0.78rem;
}

.assignment-time {
  min-width: 52px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary);
  text-align: center;
}

.assignment-time b {
  font-size: 0.92rem;
}

.assignment-order p {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.55;
}

.assignment-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.assignment-meta span {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.assignment-meta svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--primary);
  margin-top: 2px;
}

.assignment-meta b {
  color: var(--primary);
}

.incentive-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.incentive-hero > div {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(94, 113, 152, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.05);
}

.incentive-hero span {
  color: var(--muted);
  font-size: 0.82rem;
}

.incentive-hero b {
  color: var(--primary-strong);
  font-size: 1.15rem;
}

.notice-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(22, 163, 74, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(90deg, #f0fdf4, #ffffff);
}

.notice-card b,
.notice-card span {
  display: block;
}

.notice-card > div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.assignment-empty {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.field.compact {
  gap: 4px;
}

.field.compact select {
  min-height: 38px;
  padding: 7px 9px;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--ink);
  color: #fff;
}

.toast.error {
  background: #991b1b;
}

.toast.good {
  background: #166534;
}

.order-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.status-choice {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.status-choice.active.done {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.status-choice.active.postponed {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.status-choice.active.canceled {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.table-like {
  display: grid;
  gap: 8px;
}

.table-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.amount {
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

.photo-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  overflow: hidden;
  display: none;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview.visible {
  display: block;
}

@media (min-width: 720px) {
  .login-screen {
    width: min(100%, 440px);
    margin: 0 auto;
  }

  .content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .section.wide,
  .top-stats {
    grid-column: 1 / -1;
  }

  .top-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .assignment-board {
    grid-auto-columns: minmax(280px, 1fr);
    grid-auto-flow: column;
  }
}

@media (max-width: 430px) {
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .incentive-hero {
    grid-template-columns: 1fr;
  }

  .card-row {
    align-items: stretch;
    flex-direction: column;
  }

  .actions .button {
    flex: 1 1 auto;
  }
}
