:root {
    --bg: #f4f1e9;
    --bg-accent: linear-gradient(120deg, #f4f1e9 0%, #f1f6f0 35%, #fdf8e8 100%);
    --ink: #1e2424;
    --muted: #5f6b6b;
    --primary: #244f50;
    --ok: #2d7f5e;
    --warn: #c87721;
    --bad: #b23a2f;
    --card: #ffffff;
    --border: #d7dfd6;
    --shadow: 0 10px 18px rgba(25, 34, 33, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--ink);
    background: var(--bg-accent);
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(36, 79, 80, 0.95);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-header__title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.app-header__nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

.app-header__nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}

.app-header__user {
    font-weight: 700;
    opacity: 0.92;
}

.app-header__logout {
    margin: 0;
}

.app-header__logout button {
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 8px 12px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.app-main {
    padding: 20px;
}

.board-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.board-toolbar h1 {
    margin: 0 0 6px;
    font-size: 1.8rem;
}

.board-toolbar p {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.board-toolbar__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
}

.service-error {
    background: #fbe3e1;
    color: var(--bad);
    border: 1px solid #f3c2bd;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.kanban-grid-wrap {
    overflow-x: auto;
}

.kanban-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(280px, 1fr));
    gap: 14px;
    min-width: 1100px;
}

.kanban-column {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    min-height: 560px;
    position: relative;
}

.kanban-column__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.kanban-column__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.kanban-column__header span {
    background: var(--primary);
    color: #fff;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
    padding: 4px 8px;
    font-weight: 800;
}

.kanban-column__body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 220px;
    transition: background-color 0.14s ease;
    border-radius: 0 0 16px 16px;
}

.drop-zone-indicator {
    display: none;
    border: 2px dashed #7f9b9c;
    color: #355f61;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
    background: rgba(127, 155, 156, 0.12);
}

.order-card {
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    border: 2px solid transparent;
    box-shadow: var(--shadow);
    font-size: 1rem;
}

.js-order-card {
    cursor: grab;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.js-order-card:active {
    cursor: grabbing;
}

.order-card--dragging {
    cursor: grabbing;
    transform: rotate(1.5deg) scale(1.02);
    box-shadow: 0 16px 22px rgba(20, 29, 28, 0.24);
}

.order-card-placeholder {
    border: 2px dashed #88a4a5;
    border-radius: 12px;
    background: rgba(136, 164, 165, 0.15);
}

.kanban-column--drop-target {
    outline: 2px dashed #88a4a5;
    outline-offset: -4px;
}

.kanban-column--drop-target .kanban-column__body {
    background: rgba(136, 164, 165, 0.12);
}

.kanban-column--drop-target .drop-zone-indicator {
    display: block;
}

.board-is-dragging {
    user-select: none;
}

.order-card--urgent {
    border-color: var(--warn);
}

.order-card--overdue {
    border-color: var(--bad);
    background: #fff5f4;
}

.order-card__top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.order-card__number {
    font-size: 1.1rem;
    font-weight: 800;
}

.order-card__source {
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
}

.order-card__line {
    margin-top: 4px;
    font-weight: 700;
}

.order-card__drag-tip {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.deadline-note {
    margin-top: 8px;
    font-weight: 800;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.deadline-note--urgent {
    color: #77460a;
    background: #ffeed8;
}

.deadline-note--overdue {
    color: #842a21;
    background: #ffdeda;
}

.order-card__items-title {
    margin-top: 10px;
    font-weight: 800;
}

.order-card__items {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 1rem;
    line-height: 1.35;
}

.complete-btn {
    width: 100%;
    margin-top: 12px;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    background: var(--ok);
    color: #fff;
}

.complete-badge {
    margin-top: 12px;
    background: #e3f5eb;
    color: #1f5e45;
    font-weight: 800;
    text-align: center;
    border-radius: 10px;
    padding: 10px;
}

.column-empty {
    text-align: center;
    padding: 18px 10px;
    color: var(--muted);
    font-weight: 700;
}

.flash-wrapper {
    position: fixed;
    top: 84px;
    right: 20px;
    z-index: 60;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 24px));
    pointer-events: none;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #ccd9ee;
    background: #edf2ff;
    color: #27466d;
    font-weight: 700;
    box-shadow: 0 14px 30px rgba(20, 29, 28, 0.12);
}

.flash-success {
    background: #e3f5eb;
    border-color: #b7dec7;
    color: #1f5e45;
}

.flash-error {
    background: #fbe3e1;
    border-color: #edb7b0;
    color: #842a21;
}

.flash-warning {
    background: #fff0dc;
    border-color: #edcfab;
    color: #7a4a10;
}

.flash-info {
    background: #edf2ff;
    border-color: #ccd9ee;
    color: #27466d;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 14px;
}

.metric-card h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--muted);
}

.metric-card p {
    margin: 8px 0 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.status-table {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.status-table h2 {
    margin-top: 0;
}

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

.status-table th,
.status-table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 10px;
}

@media (max-width: 1024px) {
    .app-main {
        padding: 12px;
    }

    .board-toolbar {
        flex-direction: column;
    }

    .kanban-grid {
        min-width: 900px;
    }
}

.admin-body .app-main {
    padding: 0;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 66px);
}

.admin-shell__sidebar {
    background: linear-gradient(180deg, #5a468f 0%, #5f4c95 100%);
    color: #fff;
    padding: 24px 18px;
}

.admin-brand {
    margin-bottom: 28px;
}

.admin-brand__title {
    font-size: 1.5rem;
    font-weight: 800;
}

.admin-brand__subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 600;
}

.admin-nav {
    display: grid;
    gap: 8px;
}

.admin-nav__link {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-weight: 700;
    border-radius: 14px;
    padding: 12px 14px;
}

.admin-nav__link.is-active,
.admin-nav__link:hover {
    background: rgba(36, 20, 77, 0.28);
}

.admin-shell__content {
    padding: 28px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.action-card,
.admin-link-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.action-card h3,
.admin-link-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.action-card p,
.admin-link-card p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.45;
}

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

.admin-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.admin-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}

.admin-btn--ghost {
    background: #eef4f4;
    color: var(--primary);
}

.admin-btn--dark {
    background: #1f2428;
}

.admin-btn--danger {
    background: #d43a48;
}

.admin-btn--small {
    padding: 8px 10px;
    font-size: 0.82rem;
}

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

.editor-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 0;
    min-height: 70vh;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.editor-list-panel {
    background: rgba(255, 255, 255, 0.9);
    border-right: 1px solid var(--border);
    padding: 18px;
}

.editor-list-panel h2,
.editor-detail-panel h2 {
    margin-top: 0;
}

.editor-list {
    display: grid;
    gap: 0;
}

.editor-list__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 18px 14px;
    border-bottom: 1px solid #ebefea;
    background: rgba(255, 255, 255, 0.9);
}

.editor-list__item.is-active {
    background: #f0efef;
    box-shadow: inset 0 0 0 2px #6585ff;
}

.editor-list__title {
    font-weight: 800;
    font-size: 1.05rem;
}

.editor-list__subtitle {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.4;
}

.editor-list__badge {
    white-space: nowrap;
    background: #e8eef8;
    color: #31465c;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

.editor-list__empty,
.editor-placeholder {
    padding: 28px 16px;
    color: var(--muted);
    font-weight: 700;
}

.editor-detail-panel {
    padding: 24px 28px;
}

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

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.preview-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
}

.preview-card__label {
    margin-bottom: 10px;
    font-weight: 800;
}

.preview-card img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 14px;
    background: #f3f3f3;
}

.editor-form {
    display: grid;
    gap: 14px;
}

.form-row {
    display: grid;
    gap: 8px;
}

.form-row label {
    font-weight: 800;
}

.form-row input,
.form-row select,
.form-row textarea,
.training-form input,
.training-form select {
    width: 100%;
    border: 1px solid #d5d9df;
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    background: #fff;
}

.form-row textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row input[type="checkbox"],
.training-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    padding: 0;
}

.form-error,
.form-errors {
    color: var(--bad);
    font-weight: 700;
}

.form-help {
    color: var(--muted);
    font-size: 0.9rem;
}

.editor-form__actions {
    display: flex;
    justify-content: flex-start;
}

.subpanel {
    margin-top: 28px;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.subpanel__header h3 {
    margin: 0 0 8px;
}

.subpanel__header p {
    margin: 0 0 14px;
    color: var(--muted);
}

.training-form {
    display: grid;
    gap: 14px;
    margin-bottom: 18px;
}

.training-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.training-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.training-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    background: #f1f1f1;
}

.training-card__title {
    font-weight: 800;
}

.training-card__subtitle {
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-body .app-main {
    min-height: calc(100vh - 76px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.auth-shell {
    width: 100%;
    max-width: 540px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.auth-card__eyebrow {
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-card h1 {
    margin: 10px 0 12px;
}

.auth-card p {
    color: var(--muted);
    line-height: 1.5;
}

.auth-card__meta {
    font-size: 0.95rem;
}

.auth-card__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.auth-card__actions form {
    margin: 0;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

@media (max-width: 1180px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-shell__sidebar {
        padding: 18px;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-list-panel {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
}
