:root {
    --bg: #f5eee8;
    --panel: #ffffff;
    --text: #2f241a;
    --muted: #76614f;
    --brand: #6f3f1f;
    --line: #e9dbcf;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

.admin-sidebar {
    background: linear-gradient(180deg, #2d1a10 0%, #1c110b 100%);
    color: #f6e4d3;
    padding: 1.4rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-sidebar h2 {
    margin-bottom: 0.1rem;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.85rem;
}

.admin-sidebar p {
    margin-top: 0;
    color: #d6bea9;
    font-size: 0.85rem;
}

.admin-sidebar nav {
    display: grid;
    gap: 0.3rem;
    margin-top: 1rem;
}

.admin-sidebar a {
    color: #edd7c4;
    padding: 0.55rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.92rem;
}

.admin-sidebar a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.admin-content {
    padding: 1.5rem;
    min-width: 0;
    overflow-x: clip;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-topbar a {
    color: var(--brand);
    font-weight: 600;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 1rem;
}

.panel {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stat-card h4 {
    margin: 0 0 0.35rem;
    color: var(--muted);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.stat-card strong {
    font-size: 1.6rem;
    font-family: 'Cormorant Garamond', serif;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

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

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

th,
td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 0.65rem 0.5rem;
    vertical-align: top;
    overflow-wrap: anywhere;
}

th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

button,
.btn {
    border: 1px solid transparent;
    background: #5d3317;
    color: #fff;
    border-radius: 0.45rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.83rem;
    cursor: pointer;
}

.btn.secondary {
    background: #fff;
    color: #4b3423;
    border-color: #ceb8a7;
}

.btn.danger {
    background: #8d2c2c;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d9c6b6;
    border-radius: 0.45rem;
    padding: 0.55rem 0.65rem;
    margin: 0.2rem 0 0.65rem;
    font-family: inherit;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
}

.notice {
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.85rem;
}

.notice.success {
    background: #e7f7ea;
    color: #1d6c34;
}

.notice.error {
    background: #fde8e8;
    color: #8a1e1e;
}

.sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sidebar-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f6e4d3;
    border-radius: 0.45rem;
    padding: 0.35rem 0.55rem;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1.2rem;
}

.addon-group {
    margin: 0.35rem 0 0.95rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafafa;
}

.addon-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 0.65rem;
}

.addon-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 0.9rem;
}

.addon-option {
    display: grid;
    grid-template-columns: 16px 1fr;
    align-items: start;
    column-gap: 0.5rem;
    font-weight: 400;
    font-size: 0.88rem;
    cursor: pointer;
    line-height: 1.3;
}

.addon-option span {
    margin-top: 0.02rem;
}

.addon-option input,
.addon-select-all input {
    margin: 0;
    flex-shrink: 0;
}

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

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

    .sidebar-toggle {
        display: block;
    }

    .admin-sidebar nav {
        display: none;
        margin-top: 0.5rem;
    }

    .admin-sidebar.open nav {
        display: grid;
    }

    .stat-grid,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Prevent iOS/Android auto-zoom when tapping small controls/fields. */
    .admin-sidebar a,
    .sidebar-toggle,
    button,
    .btn,
    input,
    textarea,
    select,
    label {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .addon-options {
        grid-template-columns: 1fr;
    }
}
