
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* более "рабочая" цветовая схема: синий, серый, нейтральный */
    --md-sys-color-primary: #2563eb;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #dbeafe;
    --md-sys-color-on-primary-container: #1e3a8a;

    --md-sys-color-secondary: #4b5563;
    --md-sys-color-on-secondary: #f9fafb;
    --md-sys-color-secondary-container: #e5e7eb;
    --md-sys-color-on-secondary-container: #111827;

    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-variant: #e5e7eb;
    --md-sys-color-background: #f3f4f6;

    --md-sys-color-outline: #9ca3af;
    --md-sys-color-error: #dc2626;
    --md-sys-color-on-error: #ffffff;

    --md-sys-color-on-surface: #111827;
    --md-sys-color-on-surface-variant: #6b7280;

    --md-sys-typescale-label-small-size: 11px;
    --md-sys-typescale-label-medium-size: 13px;
    --md-sys-typescale-body-small-size: 13px;
    --md-sys-typescale-body-medium-size: 14px;
    --md-sys-typescale-title-medium-size: 16px;
    --md-sys-typescale-headline-small-size: 20px;

    --radius-token: 16px;
}

body.md-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--md-sys-color-background);
    color: var(--md-sys-color-on-surface);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Elevation & motion */

.md-elevated {
    background: var(--md-sys-color-surface);
    border-radius: var(--radius-token);
    box-shadow:
      0 2px 1px rgba(0, 0, 0, 0.14),
      0 1px 1px rgba(0, 0, 0, 0.12),
      0 1px 3px rgba(0, 0, 0, 0.2);
}

@keyframes md-fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.md-fade-in {
    animation: md-fade-up 0.18s ease-out;
}

/* Top app bar */

.topbar {
    background: var(--md-sys-color-surface);
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow:
      0 2px 1px rgba(0, 0, 0, 0.14),
      0 1px 1px rgba(0, 0, 0, 0.12),
      0 1px 3px rgba(0, 0, 0, 0.2);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.topbar__title-link {
    text-decoration: none;
    color: inherit;
}

.topbar__title {
    font-size: var(--md-sys-typescale-headline-small-size);
    font-weight: 600;
    letter-spacing: 0.1px;
}

.topbar__actions {
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

/* FAB / icon buttons */

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    position: relative;
    overflow: hidden;
}

.icon-btn-main {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.icon-btn:active {
    transform: scale(0.96);
}

/* simple icons */

.icon-user,
.icon-plus,
.icon-exit,
.icon-menu,
.icon-trash {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
}

.icon-user::before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: currentColor;
    border-radius: 999px;
    top: 2px;
    left: 4px;
}
.icon-user::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 8px;
    background: currentColor;
    border-radius: 999px;
    bottom: 1px;
    left: 2px;
}

.icon-plus::before,
.icon-plus::after {
    content: "";
    position: absolute;
    background: currentColor;
}
.icon-plus::before {
    width: 2px;
    height: 18px;
    left: 8px;
    top: 0;
}
.icon-plus::after {
    width: 18px;
    height: 2px;
    left: 0;
    top: 8px;
}

.icon-exit::before,
.icon-exit::after {
    content: "";
    position: absolute;
    background: currentColor;
}
.icon-exit::before {
    width: 2px;
    height: 16px;
    left: 8px;
    top: 1px;
}
.icon-exit::after {
    width: 10px;
    height: 2px;
    left: 4px;
    top: 8px;
}

.icon-menu::before,
.icon-menu::after {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    height: 2px;
    background: currentColor;
}
.icon-menu::before {
    top: 4px;
    box-shadow: 0 4px 0 0 currentColor, 0 8px 0 0 currentColor;
}
.icon-menu::after {
    display: none;
}

/* trash icon */

.icon-trash::before,
.icon-trash::after {
    content: "";
    position: absolute;
    background: currentColor;
}

.icon-trash::before {
    /* корзина */
    left: 4px;
    right: 4px;
    bottom: 2px;
    top: 6px;
    border-radius: 2px 2px 3px 3px;
    border: 2px solid currentColor;
    border-top: none;
    background: transparent;
}

.icon-trash::after {
    /* крышка */
    left: 4px;
    right: 4px;
    top: 4px;
    height: 2px;
}

/* dropdown menu */

.topbar-menu {
    position: absolute;
    right: 0;
    top: 46px;
    min-width: 180px;
    background: var(--md-sys-color-surface);
    border-radius: 12px;
    box-shadow:
      0 4px 6px rgba(0, 0, 0, 0.10),
      0 2px 4px rgba(0, 0, 0, 0.08);
    padding: 6px 0;
    display: none;
}

.topbar-menu--open {
    display: block;
}

.topbar-menu__header {
    padding: 4px 14px 6px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--md-sys-color-on-surface-variant);
}

.topbar-menu__item {
    display: block;
    padding: 8px 14px;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
}

.topbar-menu__item:hover {
    background: var(--md-sys-color-surface-variant);
}

.main {
    padding-bottom: 20px;
}




/* svg icons */

.icon-svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Snack / flash */


.flash {
    margin-bottom: 12px;
    padding: 6px 10px;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.flash__item {
    background: #fef3c7;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: #92400e;
}
/* Filters */

.filters-card {
    margin-bottom: 12px;
    padding: 10px 12px;
}

.filters__row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--md-sys-color-surface-variant);
    font-size: var(--md-sys-typescale-label-medium-size);
    cursor: pointer;
    overflow: hidden;
    color: var(--md-sys-color-on-surface-variant);
}

.chip input {
    display: none;
}

.chip span {
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip input:checked + span {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.chip-counter {
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--md-sys-color-error);
    color: #ffffff;
    font-size: var(--md-sys-typescale-label-small-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


.filters__search {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.search-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid var(--md-sys-color-outline);
    padding: 8px 34px 8px 12px;
    background: #e5e7eb;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: none;
    background: rgba(0,0,0,0.08);
    cursor: pointer;
}

.search-clear::before,
.search-clear::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    top: 9px;
    height: 2px;
    background: rgba(31,41,55,0.85);
}

.search-clear::before {
    transform: rotate(45deg);
}

.search-clear::after {
    transform: rotate(-45deg);
}
/* Task list */

.tasks-section {
    margin-top: 4px;
}

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

.task-card {
    padding: 12px 14px 10px;
}

.task-card__header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.task-card__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-card__title {
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.task-card__urgent {
    font-size: var(--md-sys-typescale-label-small-size);
    padding: 2px 8px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
}

.task-card__text {
    font-size: var(--md-sys-typescale-body-medium-size);
    margin-top: 6px;
}

.task-card__rework {
    font-size: var(--md-sys-typescale-body-small-size);
    color: #b91c1c;
    margin-top: 4px;
}

.task-card__status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.task-card__status-main {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.task-card__pending {
    font-size: var(--md-sys-typescale-label-small-size);
    color: #b45309;
}

.task-card__accepted {
    font-size: var(--md-sys-typescale-label-small-size);
    color: #047857;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 500;
}

.status-new {
    background: #e0f2fe;
    color: #0369a1;
}
.status-in_progress {
    background: #fef3c7;
    color: #b45309;
}
.status-rework {
    background: #fee2e2;
    color: #b91c1c;
}
.status-done {
    background: #dcfce7;
    color: #15803d;
}

/* delete button in status */

/* ===== Страница уведомлений ===== */

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

.card {
    background: var(--md-sys-color-surface);
    border-radius: 16px;
    padding: 20px;
}

.h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--md-sys-color-on-surface);
}

.muted {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
    line-height: 1.4;
}

.row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* Статус уведомлений */
.note {
    min-height: 20px;
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 8px;
}


/* photos */

.task-card__photos {
    margin-top: 8px;
}

.photo-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.photo-thumb {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e5e7eb;
    cursor: pointer;
}

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

.photo-empty {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--md-sys-color-on-surface-variant);
}

/* footer */

.task-card__footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.task-card__footer-left {
    font-size: var(--md-sys-typescale-label-small-size);
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.link-small {
    font-size: var(--md-sys-typescale-label-small-size);
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

.link-small:hover {
    text-decoration: underline;
}

.task-card__footer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* buttons */

.btn {
    border-radius: 999px;
    border: none;
    padding: 8px 16px;
    font-size: var(--md-sys-typescale-label-medium-size);
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}
.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}
.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-text {
    background: transparent;
    color: var(--md-sys-color-primary);
    padding-inline: 4px;
}

/* Кнопка в состоянии отправки / disabled */
button:disabled,
input[type="submit"]:disabled {
    background: #e0e0e0 !important;
    color: #8a8a8a !important;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 1; /* важно — чтобы не выглядела "прозрачной", а именно серой */
}

/* Forms */

.form-card,
.auth-card {
    padding: 16px 14px 14px;
}

.form-title,
.auth-title {
    margin: 0 0 6px;
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 600;
}

.form-subtitle {
    margin: 12px 0 4px;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.auth-subtitle,
.form-help {
    margin: 0 0 10px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--md-sys-color-on-surface-variant);
}

.task-form,
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

label {
    font-size: var(--md-sys-typescale-label-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

input[type="text"],
input[type="password"],
textarea,
input[type="file"] {
    font-size: var(--md-sys-typescale-body-medium-size);
}

input[type="text"],
input[type="password"],
textarea {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--md-sys-color-outline);
    background: #f9fafb;
}

textarea {
    resize: vertical;
}

/* history */

.history-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    padding: 8px 8px;
    border-radius: 12px;
    background: var(--md-sys-color-surface-variant);
    font-size: var(--md-sys-typescale-body-small-size);
}

.history-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.history-date {
    color: var(--md-sys-color-on-surface-variant);
}

.history-user {
    font-weight: 500;
}

.history-status {
    color: var(--md-sys-color-on-surface);
}

.history-comment {
    margin-top: 4px;
}

.history-action {
    margin-top: 2px;
    font-size: var(--md-sys-typescale-label-small-size);
    color: var(--md-sys-color-on-surface-variant);
}

.history-back {
    margin-top: 6px;
}

/* users */

.users-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.users-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.users-role {
    color: var(--md-sys-color-on-surface-variant);
}

/* Lightbox */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
}

.lightbox--open {
    display: flex;
    animation: md-fade-up 0.18s ease-out;
}

.lightbox__content {
    position: relative;
    max-width: 96%;
    max-height: 90%;
}

.lightbox__img {
    max-width: 93vw;
    max-height: 70vh;
    border-radius: 16px;
    box-shadow:
      0 8px 10px rgba(0, 0, 0, 0.24),
      0 3px 14px rgba(0, 0, 0, 0.18);
    z-index: 1000;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
    position: absolute;
    border: none;
    background: rgba(31, 41, 55, 0.85);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox__close {
    top: -18px;
    right: -18px;
    font-size: 20px;
}

.lightbox__prev {
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
}

.lightbox__next {
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
}

/* Responsive */

@media (min-width: 720px) {
    .filters__row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .filters__search {
        max-width: 280px;
    }
}

@media (min-width: 640px) {
    .task-card {
        padding: 14px 16px 12px;
    }
}

@media (max-width: 640px) {
    .topbar__inner {
        padding: 8px 8px;
    }
    .topbar__title {
        margin-left: 4px;
    }
    .topbar__actions {
        margin-right: 4px;
    }
}


/* Acceptance / pending badges styled like other statuses */
.status-pending {
    background: #fff7ed;
    color: #b45309;
}
.status-accepted {
    background: #ecfdf5;
    color: #047857;
}

/* Card menu (⋮) */
.task-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
}

.task-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.task-menu-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.task-menu-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    min-width: 170px;
    background: var(--md-sys-color-surface);
    border-radius: 12px;
    display: none;
    padding: 6px;
    z-index: 60;
}

.task-menu.open .task-menu-dropdown {
    display: block;
}

.task-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 10px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
}

.task-menu-item:hover {
    background: var(--md-sys-color-surface-variant);
}

.task-menu-item.danger {
    color: var(--md-sys-color-error);
}


/* Ensure card can host absolute-positioned menu */
.task-card {
    position: relative;
}

/* Menu in the top-right corner */
.task-menu--corner {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 12;
}

.task-menu-sep {
    height: 1px;
    background: var(--md-sys-color-surface-variant);
    margin: 6px 6px;
    border-radius: 999px;
}

/* Status badges inline (Done + Pending/Accepted) */
.task-card__status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Reserve space for corner menu only when it exists */
.task-card--has-menu .task-card__header {
    padding-right: 52px;
}

/* Topbar padding for mobile + tablet */
.topbar__inner {
    padding: 8px 16px;
}
@media (max-width: 1024px) {
    .topbar__inner {
        padding: 8px 16px;
    }
}


/* ===== Users admin page ===== */
.users-item--card {
    display: block;
    padding: 14px;
    border-radius: 16px;
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-surface-variant);
    margin-bottom: 12px;
}

.users-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.users-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.users-actions {
    display: grid;
    gap: 12px;
}

.users-form {
    display: grid;
    gap: 6px;
}

.users-label {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.users-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.users-inline .input {
    flex: 1 1 220px;
    min-width: 180px;
}
