* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: #183153;
    background:
        radial-gradient(circle at top right, rgba(255, 193, 7, 0.18), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #fff7ea 100%);
}

.app-shell {
    width: min(1280px, calc(100vw - 24px));
    margin: 14px auto 24px;
}

.hidden {
    display: none !important;
}

.login-view,
.dashboard-view {
    display: grid;
    gap: 18px;
}

.login-card,
.topbar,
.workspace {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #dee7f5;
    border-radius: 24px;
    box-shadow: 0 18px 38px rgba(24, 49, 83, 0.08);
}

.login-card {
    width: min(560px, 100%);
    margin: 48px auto 0;
    padding: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9b7b00;
}

h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    color: #143d7a;
}

.lead {
    margin: 10px 0 0;
    color: #52657f;
    line-height: 1.65;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.captcha-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 12px;
}

.login-form label,
.module-head {
    display: grid;
    gap: 6px;
}

.login-form label > span {
    font-size: 0.84rem;
    font-weight: 700;
    color: #755600;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c8d6ec;
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
}

.btn-primary {
    background: #1f5fbf;
    color: #fff;
}

.btn-muted {
    background: #75808f;
    color: #fff;
}

.btn-light {
    background: #eef4ff;
    color: #214774;
    border: 1px solid #cddcf4;
}

.btn-inline {
    padding: 8px 12px;
}

.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #c8d6ec;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    min-height: 48px;
}

.message {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #d9e6fb;
}

.message.info {
    background: #eef4ff;
    color: #214774;
}

.message.success {
    background: #ebfff2;
    border-color: #b7ebc5;
    color: #17613a;
}

.message.error {
    background: #fff1f1;
    border-color: #f4c7c7;
    color: #9b1c1c;
}

.topbar {
    padding: 10px 16px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

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

.session-headline {
    color: #9b7b00;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.workspace {
    padding: 10px;
}

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

.menu-tile {
    border: 1px solid #e6c35a;
    border-radius: 16px;
    background: #fff5d6;
    color: #7a5800;
    padding: 8px 13px;
    font-weight: 800;
    cursor: pointer;
    flex: 0 0 auto;
}

.menu-tile.active {
    background: #ffc107;
    color: #1a1a1a;
}

.menu-tile-logout {
    background: #75808f;
    border-color: #75808f;
    color: #fff;
}

.menu-tile-logout:hover,
.menu-tile-logout:focus-visible {
    background: #667181;
    border-color: #667181;
    outline: none;
}

.module-card {
    display: none;
    margin-top: 10px;
    border: 1px solid #e4ebf6;
    border-radius: 18px;
    padding: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fffdf5 100%);
    min-height: 220px;
}

.module-card.active {
    display: grid;
    align-content: start;
    gap: 16px;
}

.module-head h2 {
    margin: 0;
    color: #143d7a;
}

.module-head p {
    margin: 6px 0 0;
    color: #5e708d;
    line-height: 1.45;
}

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

.section-head h3 {
    margin: 0;
    color: #143d7a;
    font-size: 1.05rem;
}

.section-head p {
    margin: 6px 0 0;
    color: #5e708d;
    line-height: 1.45;
}

.vendor-page {
    display: none;
}

.vendor-page.active {
    display: block;
}

.vendor-section,
.vendor-form {
    display: grid;
    gap: 18px;
}

.item-section,
.item-form {
    display: grid;
    gap: 18px;
}

.vendor-table-wrap {
    overflow-x: auto;
    border: 1px solid #d9e3f2;
    border-radius: 18px;
    background: #fff;
}

.vendor-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.vendor-table th,
.vendor-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #ebf0f8;
    text-align: left;
    vertical-align: top;
}

.vendor-table th {
    background: #f6f9ff;
    color: #5c6f8f;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.vendor-table tbody tr:last-child td {
    border-bottom: none;
}

.vendor-table .table-empty {
    text-align: center;
    color: #6c7c96;
    padding: 28px 16px;
}

.btn-edit {
    min-width: 88px;
}

.vendor-actions-footer,
.vendor-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.vendor-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.item-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.vendor-form label,
.editor-field {
    display: grid;
    gap: 6px;
}

.vendor-form label > span,
.editor-field > span {
    font-size: 0.84rem;
    font-weight: 700;
    color: #755600;
}

.vendor-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.editor-field {
    padding: 16px;
    border: 1px solid #dde6f3;
    border-radius: 18px;
    background: #fff;
}

.item-table-wrap {
    overflow-x: auto;
    border: 1px solid #d9e3f2;
    border-radius: 18px;
    background: #fff;
}

.item-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

.item-table th,
.item-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #ebf0f8;
    text-align: left;
    vertical-align: top;
}

.item-table th {
    background: #f6f9ff;
    color: #5c6f8f;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.item-table tbody tr:last-child td {
    border-bottom: none;
}

.item-table .table-empty {
    text-align: center;
    color: #6c7c96;
    padding: 28px 16px;
}

.item-form-actions,
.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.item-form-actions {
    justify-content: flex-end;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff4d1;
    color: #8a6500;
    font-size: 0.82rem;
    font-weight: 800;
}

.rich-editor {
    border: 1px solid #c8d6ec;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px;
    border-bottom: 1px solid #e6edf8;
    background: #f7faff;
}

.editor-toolbar button {
    border: 1px solid #cddcf4;
    border-radius: 10px;
    padding: 7px 10px;
    background: #fff;
    color: #214774;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.editor-toolbar button:hover,
.editor-toolbar button:focus-visible {
    background: #eaf2ff;
    outline: none;
}

.toolbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

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

.editor-surface {
    min-height: 150px;
    padding: 14px;
    line-height: 1.6;
    color: #183153;
}

.editor-surface:focus {
    outline: none;
}

.editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #8a98af;
}

.editor-surface p {
    margin: 0 0 10px;
}

.editor-surface p:last-child {
    margin-bottom: 0;
}

.editor-surface ul,
.editor-surface ol {
    margin: 0 0 10px 20px;
    padding: 0;
}

.empty-state {
    min-height: 120px;
    border: 1px dashed #d3dfef;
    border-radius: 18px;
    background: #fbfdff;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    color: #5e708d;
}

.empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #143d7a 0%, #2458a8 100%);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 12px;
}

@media (max-width: 900px) {
    .menu-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 640px) {
    .app-shell {
        width: min(100vw - 14px, 1280px);
        margin: 8px auto 16px;
    }

    .login-card,
    .topbar,
    .workspace,
    .module-card {
        border-radius: 18px;
    }

    .login-card,
    .topbar,
    .workspace,
    .module-card {
        padding: 16px;
    }

    .menu-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .btn,
    .topbar-actions {
        width: 100%;
    }

    .captcha-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .session-headline {
        white-space: normal;
    }

    .topbar-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .section-head,
    .vendor-actions-footer,
    .vendor-form-actions,
    .item-form-actions {
        flex-direction: column;
    }

    .vendor-actions-footer .btn,
    .vendor-form-actions .btn,
    .item-form-actions .btn {
        width: 100%;
    }

    .vendor-form-grid,
    .vendor-editor-grid,
    .item-form-grid {
        grid-template-columns: 1fr;
    }

    .vendor-table {
        min-width: 640px;
    }

    .item-table {
        min-width: 760px;
    }

    .editor-field {
        padding: 14px;
    }

    .editor-toolbar {
        gap: 6px;
    }

    .editor-toolbar button {
        flex: 1 1 calc(50% - 6px);
    }
}
