:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d9e2ec;
    --blue: #536d8d;
    --blue-dark: #344f73;
    --green: #12805c;
    --red: #c2413a;
    --shadow: 0 16px 40px rgba(20, 30, 45, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

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

img {
    display: block;
    max-width: 100%;
}

.auth-page {
    align-items: center;
    background:
        radial-gradient(circle at 12% 20%, rgba(231, 169, 199, 0.2), transparent 28%),
        radial-gradient(circle at 86% 12%, rgba(83, 109, 141, 0.18), transparent 30%),
        var(--bg);
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.auth-shell {
    margin: 0 auto;
    max-width: 430px;
    width: 100%;
}

.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px;
    text-align: center;
}

.auth-mark {
    align-items: center;
    background: rgba(83, 109, 141, 0.12);
    border-radius: 16px;
    color: var(--blue-dark);
    display: inline-flex;
    font-size: 1.4rem;
    height: 56px;
    justify-content: center;
    margin-bottom: 18px;
    width: 56px;
}

.auth-card h1 {
    font-size: 1.65rem;
    margin-bottom: 8px;
}

.auth-card p {
    color: var(--muted);
    margin-bottom: 24px;
}

.back-link {
    color: var(--blue-dark);
    display: inline-block;
    font-weight: 700;
    margin-top: 18px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #152234;
    color: #eef4fb;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: block;
    margin-bottom: 28px;
    padding: 0 10px;
}

.admin-brand span {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
}

.admin-brand small {
    color: #a7b5c8;
}

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

.admin-nav a,
.sidebar-actions a {
    align-items: center;
    border-radius: 10px;
    color: #d7e2ef;
    display: flex;
    gap: 10px;
    padding: 11px 12px;
    transition: background 0.2s ease, color 0.2s ease;
}

.admin-nav a:hover,
.admin-nav a.active,
.sidebar-actions a:hover {
    background: rgba(255, 255, 255, 0.11);
    color: white;
}

.admin-nav i,
.sidebar-actions i {
    width: 20px;
}

.sidebar-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding-top: 16px;
}

.admin-main {
    padding: 28px;
}

.admin-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 22px;
}

.admin-header p {
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 2px;
}

.admin-header h1 {
    font-size: 2rem;
}

.alert {
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert.success {
    background: #e7f8f1;
    color: var(--green);
}

.alert.error {
    background: #fff1f0;
    color: var(--red);
}

.alert.info {
    background: #eef6ff;
    color: var(--blue-dark);
}

.panel,
.stats-grid article,
.item-card,
.gallery-admin-item,
.note-admin-item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.panel {
    margin-bottom: 22px;
    padding: 22px;
}

.panel h2,
.grid-form h2 {
    font-size: 1.1rem;
    margin-bottom: 14px;
}

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

.grid-form h2,
.grid-form .span-2 {
    grid-column: 1 / -1;
}

.stack-form {
    display: grid;
    gap: 15px;
    text-align: left;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

input,
textarea,
select {
    background: #fbfdff;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    outline: none;
    padding: 11px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(83, 109, 141, 0.12);
}

.check-line {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.check-line input {
    width: auto;
}

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

.primary-btn,
.ghost-btn,
.danger-btn {
    align-items: center;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
}

.primary-btn {
    background: var(--blue);
    color: white;
}

.primary-btn:hover {
    background: var(--blue-dark);
}

.ghost-btn {
    background: #eef3f8;
    color: var(--blue-dark);
}

.danger-btn {
    background: #fff1f0;
    color: var(--red);
}

.demo-mode input:disabled,
.demo-mode textarea:disabled,
.demo-mode select:disabled {
    background: #eef3f8;
    color: var(--muted);
    cursor: not-allowed;
}

.demo-mode button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.danger-btn.full {
    width: 100%;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 22px;
}

.stats-grid article {
    padding: 22px;
}

.stats-grid i {
    color: var(--blue);
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.stats-grid strong {
    display: block;
    font-size: 2rem;
}

.stats-grid span,
.status-list p,
.item-card p,
.item-card small,
.list-row span,
.list-row p {
    color: var(--muted);
}

.status-list {
    display: grid;
    gap: 8px;
}

.content-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.item-card {
    display: grid;
    gap: 14px;
    grid-template-columns: 90px 1fr;
    padding: 14px;
}

.item-card img {
    border-radius: 12px;
    height: 110px;
    object-fit: cover;
    width: 90px;
}

.item-card h3 {
    margin-bottom: 2px;
}

.item-card small {
    display: block;
    margin-top: 8px;
    overflow-wrap: anywhere;
}

.row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
}

.gallery-admin-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.gallery-admin-item {
    overflow: hidden;
    padding: 12px;
}

.gallery-admin-item img {
    border-radius: 12px;
    height: 190px;
    object-fit: cover;
    width: 100%;
}

.gallery-admin-item form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.list-panel {
    display: grid;
    gap: 12px;
}

.list-row {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr auto;
    padding-bottom: 12px;
}

.list-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.list-row span {
    display: block;
    font-size: 0.9rem;
    margin: 3px 0;
}

.note-admin-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.note-admin-item {
    box-shadow: 7px 12px 26px rgba(20, 30, 45, 0.1);
    min-height: 180px;
    padding: 18px;
}

.note-admin-item p {
    font-size: 1.05rem;
    margin-bottom: 14px;
}

.note-admin-item strong {
    display: block;
    margin-bottom: 16px;
    text-align: right;
}

.note-admin-item.color-1 { background: #fff59d; }
.note-admin-item.color-2 { background: #f8bbd0; }
.note-admin-item.color-3 { background: #c8e6c9; }
.note-admin-item.color-4 { background: #b3e5fc; }
.note-admin-item.color-5 { background: #e1bee7; }
.note-admin-item.color-6 { background: #ffccbc; }

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

    .sidebar {
        height: auto;
        position: static;
    }

    .admin-nav {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }

    .sidebar-actions {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 18px;
    }

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

@media (max-width: 680px) {
    .admin-main {
        padding: 18px;
    }

    .grid-form,
    .stats-grid,
    .list-row {
        grid-template-columns: 1fr;
    }

    .content-grid,
    .gallery-admin-grid,
    .note-admin-grid {
        grid-template-columns: 1fr;
    }

    .item-card {
        grid-template-columns: 78px 1fr;
    }

    .item-card img {
        height: 92px;
        width: 78px;
    }
}
