:root {
    --mg-red: #f07030;
    --mg-red-deep: #d85a1c;
    --mg-ink: #203060;
    --mg-ink-soft: #284068;
    --mg-cream: #f4f6f9;
    --mg-paper: #ffffff;
    --mg-line: #d9e0ea;
    --mg-muted: #5c6b84;
    --mg-gold: #7eb23a;
    --mg-green: #6fa332;
    --sidebar: 272px;
    --font-display: "Outfit", sans-serif;
    --font-body: "Manrope", sans-serif;
    --shadow: 0 18px 40px rgba(32, 48, 96, 0.08);
}

* { box-sizing: border-box; }

html { font-size: 13px; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--mg-ink);
    background: var(--mg-cream);
}

h1, h2, h3, .brand strong, .topbar-copy h1 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

a { color: var(--mg-red-deep); }

.form-control,
.form-select,
.btn,
.admin-nav-link,
.dropdown-item,
.sidebar-logout {
    font-size: 12px;
}

.form-control,
.form-select {
    border-color: #d5deea;
    border-radius: 10px;
    min-height: 34px;
    background: #fff;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--mg-red);
    box-shadow: 0 0 0 0.2rem rgba(240, 112, 48, 0.18);
}

.form-check-input:checked {
    background-color: var(--mg-red);
    border-color: var(--mg-red);
}

.alert-danger {
    background: #fff1e8;
    border-color: #f6c7ad;
    color: #9a3d12;
}

.form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--mg-ink-soft);
}

.invalid-feedback:empty,
.alert:empty { display: none !important; }

.btn-mg,
.btn-ghost,
.btn-danger-solid,
.btn-icon {
    border-radius: 12px;
    font-weight: 700;
}

.btn-mg {
    background: var(--mg-red);
    border: 1px solid var(--mg-red);
    color: #fff;
    padding: 0.45rem 0.8rem;
}

.btn-mg:hover,
.btn-mg:focus {
    background: var(--mg-red-deep);
    border-color: var(--mg-red-deep);
    color: #fff;
}

.btn-ghost {
    background: #fff;
    border: 1px solid var(--mg-line);
    color: var(--mg-ink);
    padding: 0.55rem 0.9rem;
}

.btn-ghost:hover { background: #f3f6fb; color: var(--mg-ink); }

.btn-danger-solid {
    background: var(--mg-red);
    border: 1px solid var(--mg-red);
    color: #fff;
    padding: 0.55rem 0.9rem;
}

.btn-danger-solid:hover { background: var(--mg-red-deep); color: #fff; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: #fff;
    border: 1px solid var(--mg-line);
    color: var(--mg-ink-soft);
}

.btn-icon:hover { color: var(--mg-ink); background: #f3f6fb; }

.btn-icon-danger:hover {
    color: var(--mg-red-deep);
    border-color: #f6c7ad;
    background: #fff4ec;
}

.brand-logo {
    display: block;
    height: 36px;
    width: auto;
    max-width: 132px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 3px 7px;
}

.login-brand .brand-logo {
    height: 46px;
    max-width: 170px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: #fff1e8;
    color: var(--mg-red-deep);
    font-family: var(--font-display);
    font-weight: 700;
    flex: 0 0 auto;
}

.avatar-sm { width: 32px; height: 32px; border-radius: 10px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.15rem; }

.role-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    background: #e8eef8;
    color: var(--mg-ink);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.role-pill.is-admin {
    background: #fff1e8;
    color: var(--mg-red-deep);
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--mg-gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.guest-body { background: #e7edf5; }

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
}

.login-brand {
    position: relative;
    overflow: hidden;
    color: #f4f7fc;
    background:
        radial-gradient(900px 420px at -10% -10%, rgba(240, 112, 48, 0.55), transparent 55%),
        radial-gradient(700px 380px at 110% 110%, rgba(144, 200, 72, 0.28), transparent 50%),
        linear-gradient(165deg, #243868 0%, #1a2748 58%, #152038 100%);
    padding: 3rem;
    display: flex;
    align-items: flex-end;
}

.login-brand-inner { position: relative; z-index: 1; max-width: 460px; }
.login-brand h1 { font-size: 1.65rem; line-height: 1.15; margin: 1.6rem 0 0.6rem; }
.login-brand p { color: #d5deee; font-size: 13px; max-width: 42ch; }

.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 13px; }
.brand-copy small { color: #8ea0bf; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }
.brand-light .brand-copy small { color: #c5d2e6; }

.brand-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0.8rem; }
.brand-points li { display: flex; gap: 0.75rem; align-items: center; color: #e7eef8; font-weight: 600; }
.brand-points i { width: 1.2rem; color: #f0a070; }

.login-octagon {
    position: absolute;
    width: min(70%, 520px);
    right: -8%;
    top: 8%;
    opacity: 0.14;
}
.login-octagon polygon { fill: none; stroke: #fff; stroke-width: 1.5; }

.login-panel {
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
}

.login-card {
    width: min(100%, 440px);
    background: var(--mg-paper);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.login-card h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.login-lead { color: var(--mg-muted); margin-bottom: 1.25rem; }
.login-alert { border: 0; border-radius: 12px; }
.login-hint {
    margin: 1rem 0 0;
    color: var(--mg-muted);
    font-size: 0.86rem;
    background: #f4f7fb;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
}
.login-hint i { color: var(--mg-gold); margin-right: 0.35rem; }

.input-icon { position: relative; }
.input-icon > i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8a9bb4;
    pointer-events: none;
}
.input-icon .form-control { padding-left: 2.55rem; }
.input-icon:has(.icon-button) .form-control { padding-right: 2.7rem; }
.icon-button {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #5c6b84;
    width: 36px;
    height: 36px;
}

.admin-body { background: var(--mg-cream); }

.admin-app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.admin-sidebar {
    background: #1a2748;
    color: #f4f7fc;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-sidebar .brand { padding: 0.35rem 0.55rem 1.1rem; }
.admin-sidebar .brand-copy small { color: #a9b7d0; }

.admin-nav { display: grid; gap: 0.35rem; }
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #d5deee;
    text-decoration: none;
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    font-weight: 700;
}
.admin-nav-link i { width: 1.2rem; text-align: center; }
.admin-nav-link:hover { background: #2a3d68; color: #fff; }
.admin-nav-link.is-active { background: var(--mg-red); color: #fff; }

.sidebar-foot { margin-top: auto; display: grid; gap: 0.55rem; }
.sidebar-user {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    text-decoration: none;
    color: inherit;
    padding: 0.45rem;
    border-radius: 14px;
}
.sidebar-user:hover { background: #2a3d68; color: inherit; }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user small {
    color: #a9b7d0;
    font-size: 11px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-logout {
    width: 100%;
    border: 0;
    background: transparent;
    color: #d5deee;
    text-align: left;
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    font-weight: 700;
}
.sidebar-logout:hover { background: #2a3d68; color: #fff; }
.sidebar-logout i { margin-right: 0.45rem; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--mg-line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
}
.topbar-copy h1 { margin: 0; font-size: 1.05rem; }
.topbar-copy p { margin: 0; color: var(--mg-muted); font-size: 12px; }
.menu-button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--mg-line);
    background: #fff;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--mg-line);
    background: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
    font-weight: 700;
}
.user-chip.dropdown-toggle::after { margin-left: 0.45rem; }
.dropdown-item { display: flex; align-items: center; gap: 0.55rem; font-weight: 650; }
.dropdown-item i { width: 1rem; color: var(--mg-muted); }

.admin-page { padding: 1.5rem; }
.admin-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.5);
    z-index: 1030;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.admin-backdrop.is-visible { opacity: 1; pointer-events: auto; }

.hero-card,
.panel,
.stat-card {
    background: var(--mg-paper);
    border: 1px solid #e3e9f2;
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(32, 48, 96, 0.05);
}

.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1rem;
    background:
        linear-gradient(120deg, rgba(240, 112, 48, 0.12), transparent 42%),
        var(--mg-paper);
}
.hero-card h2 { margin: 0 0 0.3rem; font-size: 1.2rem; }
.hero-card p { margin: 0; color: var(--mg-muted); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.stat-card { padding: 1.1rem 1.15rem 1rem; }
.stat-card p { margin: 0.7rem 0 0.1rem; color: var(--mg-muted); font-weight: 700; font-size: 12px; }
.stat-card strong { font-family: var(--font-display); font-size: 1.35rem; letter-spacing: -0.04em; }
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
}
.tone-red { background: #fff1e8; color: var(--mg-red); }
.tone-gold { background: #f3f8e8; color: var(--mg-green); }
.tone-green { background: #eef6dc; color: var(--mg-green); }
.tone-ink { background: #e8eef8; color: var(--mg-ink); }

.split-grid {
    display: grid;
    grid-template-columns: 1.45fr 0.85fr;
    gap: 1rem;
}
.panel { padding: 1.15rem 1.2rem 1.2rem; }
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}
.panel-head h2, .profile-card h3, .profile-aside h2 { margin: 0; font-size: 1rem; }
.panel-head p, .field-hint { color: var(--mg-muted); margin: 0.2rem 0 0; font-size: 12px; }
.panel-head a { font-weight: 800; text-decoration: none; }

.recent-list { display: grid; }
.recent-row, .member-cell, .profile-identity {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.recent-row {
    padding: 0.75rem 0;
    border-top: 1px solid #e6ebf2;
}
.recent-row strong, .member-cell strong, .profile-identity strong { display: block; }
.recent-row small, .member-cell small, .profile-identity small { color: var(--mg-muted); }
.recent-row .role-pill { margin-left: auto; }

.empty-state {
    text-align: center;
    color: var(--mg-muted);
    padding: 1.5rem 1rem;
}
.empty-state i { font-size: 1.4rem; color: #b7c3d6; display: block; margin-bottom: 0.4rem; }

.rate-figure {
    font-family: var(--font-display);
    font-size: 1.7rem;
    letter-spacing: -0.05em;
    margin: 0.2rem 0 0.6rem;
    line-height: 1;
}
.rate-bar {
    height: 10px;
    background: #e6ebf2;
    border-radius: 999px;
    overflow: hidden;
}
.rate-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--mg-red), var(--mg-gold));
    border-radius: inherit;
}
.note-list { list-style: none; padding: 1rem 0 0; margin: 0.6rem 0 0; display: grid; gap: 0.85rem; }
.note-list li { display: flex; gap: 0.7rem; color: var(--mg-ink-soft); font-size: 12px; }
.note-list i { color: var(--mg-red); margin-top: 0.15rem; }

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}
.list-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}
.page-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0;
    padding: 0.22rem;
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: 14px;
}
.page-tab {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: #607089;
    border-radius: 11px;
    padding: 0.42rem 0.8rem;
    font-size: 12px;
    font-weight: 700;
}
.page-tab:hover { color: var(--mg-ink); background: #f4f7fb; }
.page-tab.is-active,
.page-tab.is-active:hover { background: var(--mg-ink); color: #fff; }
.filter-button { display: inline-flex; align-items: center; gap: 0.4rem; }
.filter-badge {
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #e7edf6;
    color: var(--mg-ink);
    font-size: 10px;
    line-height: 1;
    display: inline-grid;
    place-items: center;
}
.filter-button.is-filtering { border-color: #c5d2e6; background: #f4f7fb; }
.filter-button.is-filtering .filter-badge { background: var(--mg-ink); color: #fff; }
.filter-panel { width: min(380px, 100vw); border-left: 1px solid var(--mg-line); }
.filter-panel form { display: flex; flex-direction: column; height: 100%; }
.filter-panel .offcanvas-body { flex: 1 1 auto; }
.filter-panel .offcanvas-header { border-bottom: 1px solid var(--mg-line); padding: 1rem 1.1rem; }
.filter-panel .offcanvas-title { font-size: 1.05rem; margin: 0; }
.filter-panel .offcanvas-body { padding: 1.1rem; }
.filter-panel .offcanvas-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem;
    border-top: 1px solid var(--mg-line);
}
.section-note { color: var(--mg-muted); font-size: 12px; margin: 0 0 0.75rem; flex: 1 1 220px; }
.page-toolbar .section-note { margin-bottom: 0; }
.access-card {
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: 16px;
    padding: 1rem 1.1rem 1.1rem;
    margin-bottom: 0.75rem;
}
.access-card header { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.access-card h2 { font-size: 1rem; margin: 0; }
.permission-group { margin-top: 0.7rem; }
.permission-group h3 {
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7d8ba3;
    margin: 0 0 0.4rem;
}
.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.35rem 0.75rem; }
.permission-grid .form-check { margin: 0; font-size: 12px; }

.page-toolbar { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.toolbar-search { position: relative; flex: 1 1 240px; }
.toolbar-search i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #8a9bb4;
}
.toolbar-search .form-control { padding-left: 2.4rem; }
.toolbar-role, .toolbar-type { max-width: 240px; }
.result-count { color: var(--mg-muted); font-size: 12px; margin: 0.75rem 0; font-weight: 700; }

.table-panel { padding: 0.4rem 0.4rem 0.8rem; position: relative; }
.member-table { margin: 0; font-size: 12px; }
.member-table thead th {
    color: #7d8ba3;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom-color: #e6ebf2;
    padding: 0.9rem 0.9rem;
}
.member-table td { padding: 0.85rem 0.9rem; border-bottom-color: #eef2f7; }
.column-actions { display: inline-flex; gap: 0.25rem; margin-left: 0.45rem; vertical-align: middle; }
.column-actions .btn-icon { width: 28px; height: 28px; }
.table-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.78);
    border-radius: inherit;
    font-weight: 800;
    color: var(--mg-ink-soft);
    gap: 0.4rem;
}
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin: 0.15rem 0.45rem 0.1rem;
    padding: 0.85rem 0.45rem 0.2rem;
    border-top: 1px solid #e6ebf2;
    color: #66758c;
    font-size: 13px;
    font-weight: 600;
}
.pager-summary { margin: 0; white-space: nowrap; }
.pager-pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex: 1 1 auto;
}
.pager-numbers { display: flex; align-items: center; gap: 0.35rem; }
.pager-nav,
.pager-page {
    border: 1px solid #d7dee8;
    background: #fff;
    color: #3c4a60;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}
.pager-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 34px;
    padding: 0 0.7rem;
    white-space: nowrap;
}
.pager-page {
    width: 34px;
    height: 34px;
    padding: 0;
}
.pager-page.is-current {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.pager-nav:hover:not(:disabled),
.pager-page:hover:not(.is-current) { background: #f4f7fb; }
.pager-nav:disabled,
.pager-page:disabled { opacity: 0.45; cursor: not-allowed; }
.pager-size {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    white-space: nowrap;
}
.pager-size .form-select {
    width: 72px;
    min-height: 34px;
    border-radius: 8px;
    font-weight: 700;
    color: #24324a;
}

.modal-content { border: 0; border-radius: 22px; }
.modal-header, .modal-footer { border-color: #e6ebf2; }
.modal-dialog-scrollable {
    max-height: calc(100vh - 2rem);
}
.modal-dialog-scrollable .modal-content,
.modal-dialog-scrollable .modal-content > form {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
    min-height: 0;
    overflow: hidden;
}
.modal-dialog-scrollable .modal-body {
    overflow-y: auto;
    overscroll-behavior: contain;
}
.modal-title { font-size: 1.05rem; }
.delete-body { text-align: center; padding: 1.6rem 1.4rem 0.4rem; }
.delete-body h2 { margin: 0.8rem 0 0.35rem; font-size: 1.1rem; }
.delete-body p { color: var(--mg-muted); }

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
    gap: 1rem;
    align-items: start;
}
.profile-card hr { border-color: #e6ebf2; margin: 1.2rem 0; }
.profile-identity { margin-bottom: 1.1rem; }
.profile-actions { margin-top: 1.2rem; }
.profile-aside p { color: var(--mg-muted); }

.admin-toast { border-radius: 14px; color: #fff; min-width: 260px; }
.admin-toast-success { background: var(--mg-green); }
.admin-toast-danger { background: var(--mg-red-deep); }

@media (max-width: 1199.98px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-grid, .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 991.98px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 320px; align-items: flex-end; padding: 1.5rem; }
    .login-brand h1 { margin-top: 1.15rem; font-size: 1.45rem; }
    .admin-app { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed;
        z-index: 1040;
        width: min(84vw, 320px);
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .admin-sidebar.is-open { transform: none; }
}

@media (max-width: 640px) {
    .pager { flex-wrap: wrap; justify-content: center; }
    .pager-pages { flex-wrap: wrap; flex-basis: 100%; }
}

@media (max-width: 575.98px) {
    .stat-grid { grid-template-columns: 1fr; }
    .admin-page { padding: 1rem; }
    .hero-card { align-items: flex-start; flex-direction: column; }
    .toolbar-role, .toolbar-type { max-width: none; flex: 1 1 140px; }
}

@media (prefers-reduced-motion: reduce) {
    .admin-sidebar, .admin-backdrop, .rate-bar span { transition: none; }
}

.actions-cell { white-space: nowrap; }
.actions-cell.product-actions { white-space: normal; }
.actions-cell.product-actions .btn { margin: 0.15rem 0 0.15rem 0.25rem; }
.btn-row { padding: 0.35rem 0.65rem; font-size: 12px; }
.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 280px;
}
.stock-pill {
    display: inline-flex;
    min-width: 2rem;
    justify-content: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #eef6dc;
    color: var(--mg-green);
    font-weight: 700;
}
.movement-add { color: var(--mg-green); font-weight: 700; }
.movement-deduct { color: var(--mg-red); font-weight: 700; }
.material-usage { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.material-usage-add,
.material-usage-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px auto;
    gap: 0.5rem;
    align-items: center;
}
.material-usage-add { align-items: start; margin-top: 0.55rem; }

@media (max-width: 575.98px) {
    .material-usage-add,
    .material-usage-row { grid-template-columns: minmax(0, 1fr) 88px; }
    .material-usage-add .btn,
    .material-usage-row .btn { grid-column: 1 / -1; justify-self: start; }
}

.party-card {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e6ebf2;
    border-radius: 10px;
    background: #f7f9fc;
}
.party-card strong { display: block; }
.party-card p { margin: 0.15rem 0 0; color: var(--mg-muted); }
.inquiry-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    gap: 0.45rem;
    align-items: end;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e6ebf2;
}
.quote-section { margin-bottom: 0.85rem; }
.quote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; }
.quote-grid .span-2 { grid-column: 1 / -1; }
.quote-lines { display: grid; gap: 0.75rem; }
.quote-line {
    display: grid;
    grid-template-columns: minmax(120px, 1.1fr) minmax(110px, 0.9fr) minmax(140px, 1.2fr) 76px 120px auto;
    gap: 0.45rem;
    align-items: end;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e6ebf2;
}
.quote-line .span-all { grid-column: 1 / -1; }
.quote-line-specs { margin-top: 0.15rem; }
.quote-line-specs .quote-list-head { margin-top: 0.15rem; }
.repeat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: center;
    margin-bottom: 0.45rem;
}
.repeat-row-single { grid-template-columns: minmax(0, 1fr) auto; }
.repeat-row-charge { grid-template-columns: minmax(0, 1.4fr) 140px auto auto; }
.quote-list-head { display: flex; justify-content: space-between; align-items: center; margin: 0.9rem 0 0.45rem; }
.quote-list-head .form-label { margin: 0; }
.term-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: start;
    margin-bottom: 0.55rem;
}
.quote-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.4rem;
    position: sticky;
    bottom: 0.6rem;
}
.quote-summary span { display: block; color: var(--mg-muted); font-size: 11px; font-weight: 700; }
.quote-summary strong { font-size: 14px; }
.quote-total { font-family: var(--font-display); font-size: 1.35rem !important; letter-spacing: -0.04em; }

@media (max-width: 991.98px) {
    .quote-line,
    .inquiry-line,
    .term-row,
    .repeat-row-charge { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .quote-grid { grid-template-columns: 1fr; }
}

.choice-field {
    border: 1px solid #d5deea;
    border-radius: 10px;
    background: #fff;
}

.choice-field.is-open {
    border-color: var(--mg-red);
    box-shadow: 0 0 0 0.2rem rgba(240, 112, 48, 0.18);
}

.choice-field.is-invalid {
    border-color: #dc3545;
}

.choice-field.is-invalid.is-open {
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.16);
}

.choice-field.is-invalid ~ .invalid-feedback { display: block; }

.choice-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0.3rem 2rem 0.3rem 0.45rem;
    position: relative;
    cursor: text;
}

.choice-chips {
    display: contents;
}

.choice-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    max-width: 100%;
    padding: 0.12rem 0.2rem 0.12rem 0.55rem;
    border-radius: 999px;
    background: #fff1e8;
    color: #9a3d12;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.choice-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 10px;
}

.choice-chip-remove:hover { background: rgba(154, 61, 18, 0.12); }

.choice-input {
    flex: 1 1 8rem;
    min-width: 7rem;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 0.15rem 0.1rem;
    font: inherit;
    font-size: 12px;
    color: var(--mg-ink);
}

.choice-input::placeholder { color: #8b98ad; }
.choice-input::-webkit-search-decoration,
.choice-input::-webkit-search-cancel-button { appearance: none; }

.choice-caret-btn {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 100%;
    min-height: 38px;
    border: 0;
    background: transparent;
    color: var(--mg-muted);
}

.choice-caret { font-size: 11px; transition: transform 0.15s ease; }
.choice-field.is-open .choice-caret { transform: rotate(180deg); }

.choice-menu {
    border-top: 1px solid var(--mg-line);
    padding: 0.35rem;
}

.choice-options {
    display: grid;
    gap: 0.1rem;
    max-height: 11rem;
    overflow: auto;
}

.choice-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.42rem 0.5rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--mg-ink);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.choice-option:hover { background: #f3f6fb; }
.choice-option.is-selected { background: #fff6f1; }

.choice-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: none;
    border: 1.5px solid #c5d0de;
    border-radius: 5px;
    color: transparent;
    font-size: 9px;
}

.choice-option.is-selected .choice-check {
    background: var(--mg-red);
    border-color: var(--mg-red);
    color: #fff;
}

.choice-empty {
    margin: 0;
    padding: 0.55rem 0.5rem 0.4rem;
    color: var(--mg-muted);
    font-size: 12px;
}
