:root {
    --bg: #eef7f4;
    --card: #ffffff;
    --line: #cfe2dd;
    --text: #08252a;
    --muted: #57706f;
    --green: #168676;
    --green-dark: #0c6157;
    --danger: #c93434;
    --soft: #edf6f3;
    --shadow: 0 18px 50px rgba(11, 68, 62, .11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, rgba(22, 134, 118, .13), transparent 35%), var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
    width: min(1480px, calc(100% - 32px));
    margin-inline: auto;
}

.topbar-shell {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: 14px;
}

.topbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    background: rgba(255, 255, 255, .88);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.menu-toggle {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--text);
    background: var(--soft);
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.brand-icon {
    display: flex;
    color: inherit;
    text-decoration: none;
}

.clock-box {
    display: grid;
    min-width: 150px;
    margin-left: 8px;
    line-height: 1.15;
}

.topbar-title {
    position: absolute;
    left: 50%;
    max-width: 38%;
    transform: translateX(-50%);
    color: var(--text);
    font-size: 18px;
    font-weight: 950;
    letter-spacing: -.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clock-box strong {
    font-size: 20px;
}

.clock-box span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: capitalize;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    border-radius: 12px;
}

.nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 16px;
    display: none;
    min-width: 230px;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.nav.is-open {
    display: flex;
}

.nav a,
.account a {
    color: var(--text);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 12px;
}

.nav a:hover,
.account a:hover {
    background: var(--soft);
}

.account {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    color: var(--muted);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px 6px 6px;
    background: #f7fcfa;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    padding-top: 1px;
}

.user-pill strong,
.user-pill small {
    display: block;
    line-height: 1.1;
}

.user-pill small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    border: 1px solid #f0caca;
    border-radius: 12px;
    padding: 10px 12px;
    color: #a32727;
    background: #fff6f6;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.logout-form button:hover {
    background: var(--soft);
}

.page {
    width: min(1480px, calc(100% - 32px));
    margin: 28px auto;
}

.footer,
.login-footer {
    width: min(1480px, calc(100% - 32px));
    margin: 24px auto;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    font-weight: 800;
}

.hero-card,
.card {
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 16px 22px;
    margin-bottom: 16px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--green);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0 0 12px;
}

h1 {
    font-size: clamp(24px, 3vw, 36px);
    letter-spacing: -.04em;
}

h2 {
    font-size: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(320px, 420px) 1fr;
    gap: 22px;
}

.card {
    padding: 22px;
}

.form-card {
    align-self: start;
}

label {
    display: grid;
    gap: 7px;
    margin: 0 0 14px;
    color: #294245;
    font-size: 13px;
    font-weight: 800;
}

input {
    width: 100%;
    min-height: 46px;
    border: 1px solid #bdd4ce;
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text);
    font: inherit;
    background: #f8fcfb;
}

code {
    border-radius: 7px;
    padding: 2px 6px;
    background: var(--soft);
}

[hidden] {
    display: none !important;
}

select {
    min-height: 42px;
    border: 1px solid #bdd4ce;
    border-radius: 12px;
    padding: 9px 12px;
    color: var(--text);
    font: inherit;
    font-weight: 800;
    background: #f8fcfb;
}

input:focus {
    border-color: var(--green);
    outline: 3px solid rgba(22, 134, 118, .15);
}

select:focus {
    border-color: var(--green);
    outline: 3px solid rgba(22, 134, 118, .15);
}

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

.check input {
    width: auto;
    min-height: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 900;
    cursor: pointer;
    text-decoration: none;
}

.btn:disabled {
    color: #7b908d;
    background: #e9f0ee;
    box-shadow: none;
    cursor: not-allowed;
    opacity: .82;
}

.btn-primary {
    color: #fff;
    background: var(--green);
    box-shadow: 0 12px 28px rgba(22, 134, 118, .2);
}

.btn-soft {
    color: var(--text);
    background: #e9f2ef;
}

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

.btn-disabled,
.btn-disabled:disabled {
    color: #7b908d;
    background: #e9f0ee;
    cursor: not-allowed;
    opacity: .85;
}

.table-wrap {
    overflow-x: visible;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

thead tr,
tbody tr {
    box-shadow: inset 0 -1px 0 #e0ece9;
}

th {
    color: #274348;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.actions {
    display: grid;
    grid-template-columns: 76px 64px;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
    min-width: 148px;
}

.actions form {
    margin: 0;
    display: contents;
}

.actions .btn {
    width: 100%;
    height: 40px;
    min-height: 40px;
    padding: 0 10px;
    line-height: 40px;
}


.role-form {
    margin: 0;
}

.password-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    white-space: nowrap;
}

.password-form input {
    width: 180px;
    min-width: 150px;
    min-height: 40px;
}

.password-form .btn {
    min-height: 40px;
    padding-inline: 14px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 22px;
    margin-bottom: 22px;
}

.settings-grid > .form-card {
    min-width: 0;
}

.settings-grid > .form-card:nth-child(4) {
    grid-column: 1 / -1;
}

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

.section-head p {
    margin: 0;
}

.switch-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
}

.switch-check input {
    width: 18px;
    height: 18px;
    min-height: auto;
}

.settings-save {
    margin-top: 18px;
}

.inline-action {
    margin-top: 12px;
}

.locations-panel {
    padding: 18px;
}

.locations-head {
    align-items: center;
}

.search-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.search-bar label {
    margin: 0;
}

.locations-table {
    table-layout: fixed;
}

.locations-table th:nth-child(1) {
    width: 24%;
}

.locations-table th:nth-child(2) {
    width: 42%;
}

.locations-table th:nth-child(3) {
    width: 10%;
}

.locations-table th:nth-child(4) {
    width: 13%;
}

.locations-table th:nth-child(5) {
    width: 11%;
}

.locations-table td {
    line-height: 1.35;
}

.product-prices-table {
    width: 100%;
    min-width: 0;
}

.product-prices-table th:nth-child(1) {
    width: 21%;
}

.product-prices-table th:nth-child(2) {
    width: 28%;
}

.product-prices-table th:nth-child(3) {
    width: 11%;
}

.product-prices-table th:nth-child(4) {
    width: 12%;
}

.product-prices-table th:nth-child(5) {
    width: 7%;
}

.product-prices-table th:nth-child(6) {
    width: 13%;
}

.product-prices-table th:nth-child(7) {
    width: 8%;
}

.product-prices-table td {
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: normal;
}

.status-cell {
    overflow-wrap: anywhere;
    text-transform: lowercase;
}

.line-sub {
    display: block;
    margin-top: 3px;
    font-size: 12px;
}

.distance-cell {
    font-weight: 950;
    white-space: nowrap;
}

.favorites-card {
    min-width: 0;
}

.clearance-card {
    margin-top: 22px;
    width: calc(100% - 442px);
    margin-left: auto;
}

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

.favorite-tools {
    display: flex;
    align-items: end;
    gap: 10px;
}

.favorite-tools label {
    min-width: 190px;
    margin: 0;
}

.favorite-tools form {
    margin: 0;
}

.favorite-row {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid #dfebe8;
    border-radius: 8px;
    padding: 12px;
    background: #fbfefd;
}

.favorite-row img {
    width: 86px;
    height: 86px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.favorite-title {
    display: inline-block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 17px;
    font-weight: 950;
    text-decoration: none;
}

.favorite-title:hover {
    color: var(--green-dark);
}

.favorite-prices {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    justify-items: start;
}

.favorite-prices span {
    border-radius: 999px;
    padding: 6px 9px;
    background: var(--soft);
    color: #244346;
    font-size: 12px;
    font-weight: 900;
}

.favorite-actions {
    display: grid;
    gap: 8px;
}

.favorite-actions form {
    margin: 0;
}

.product-detail-head {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.product-detail-head img {
    width: 128px;
    height: 128px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

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

.product-head-actions form {
    margin: 0;
}

.product-global-price {
    margin: 0 0 12px;
    color: #244346;
    font-weight: 800;
}

.sort-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.sort-bar label {
    min-width: 220px;
    margin: 0;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.pager .btn {
    min-width: 42px;
    min-height: 36px;
    padding: 7px 10px;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 900;
}

.pill-ok {
    color: #0f6d40;
    background: #dbf4e5;
}

.pill-off {
    color: #875116;
    background: #fff1cc;
}

.muted {
    color: var(--muted);
}

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

.alert-ok {
    color: #0d6840;
    background: #dff6e8;
}

.alert-error {
    color: #9f1f1f;
    background: #fde1e1;
}

.login-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    justify-content: center;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 10% 15%, rgba(125, 220, 205, .24), transparent 28%),
        linear-gradient(105deg, #0f4d45 0%, #13584f 50%, #f5fbf9 50.2%, #eef7f4 100%);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(360px, 560px) minmax(340px, 448px);
    gap: clamp(82px, 10vw, 150px);
    align-items: center;
    width: min(1180px, calc(100% - 56px));
    min-height: min(720px, calc(100vh - 80px));
    margin: auto;
}

.login-brand-panel {
    color: #fff;
}

.login-brand-panel .eyebrow {
    color: #9ee8dc;
}

.login-brand-panel h1 {
    max-width: 520px;
    margin-bottom: 22px;
    color: #fff;
    font-size: clamp(44px, 5.5vw, 70px);
    line-height: 1.02;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 70px;
    color: #fff;
    font-weight: 900;
    text-decoration: none;
}

.login-lead {
    max-width: 500px;
    color: rgba(255, 255, 255, .82);
    font-size: 18px;
    line-height: 1.7;
}

.login-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 34px;
    max-width: 500px;
}

.login-chips span {
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .08);
    color: #e9fffb;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.login-card {
    position: relative;
    border: 1px solid rgba(207, 226, 221, .96);
    border-radius: 28px;
    padding: clamp(28px, 4vw, 48px);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 30px 80px rgba(7, 55, 50, .17);
}

.qr-box {
    display: grid;
    place-items: center;
    margin: 12px 0;
}

.qr-box img {
    width: 220px;
    height: 220px;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 10px;
    background: #fff;
}

.secret-code {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    background: var(--soft);
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 900;
    letter-spacing: .12em;
}

.auth-manual {
    font-size: 13px;
    line-height: 1.55;
}


.auth-reset {
    margin: 12px 0 0;
    text-align: center;
}

.auth-reset button {
    border: 0;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.auth-danger-zone {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.auth-danger-zone summary {
    color: var(--muted);
    font-weight: 900;
    cursor: pointer;
}

.auth-reset-form {
    margin-top: 12px;
}

.auth-reset-form label {
    margin-bottom: 8px;
}

.backup-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.backup-codes code {
    display: block;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 950;
    letter-spacing: .08em;
}

.auth-print {
    width: 100%;
    margin-bottom: 10px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 27, 31, .46);
    backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(440px, 100%);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 26px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 28px 90px rgba(5, 38, 34, .25);
}

.modal-card h2 {
    margin-bottom: 10px;
}

.modal-card p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.scrape-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(4, 26, 30, .58);
    backdrop-filter: blur(10px);
}

.scrape-backdrop[hidden] {
    display: none;
}

.scrape-modal {
    width: min(520px, 100%);
    border: 1px solid rgba(207, 226, 221, .95);
    border-radius: 24px;
    padding: 30px;
    background: #ffffff;
    box-shadow: 0 34px 100px rgba(4, 28, 31, .32);
}

.scrape-modal h2 {
    margin-bottom: 8px;
}

.scrape-modal p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.55;
}

.scrape-live-state {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--soft);
    font-size: 13px;
    font-weight: 800;
}

.scrape-stats {
    display: grid;
    gap: 7px;
    margin-top: 10px;
    font-size: 13px;
    color: #294245;
}

.scrape-stats span {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fcfb;
    font-weight: 800;
}

.scrape-loader {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.scrape-loader span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    animation: scrapePulse 1s infinite ease-in-out;
}

.scrape-loader span:nth-child(2) {
    animation-delay: .15s;
}

.scrape-loader span:nth-child(3) {
    animation-delay: .3s;
}

.scrape-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e4efec;
    margin: 18px 0;
}

.scrape-progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #73c6b7);
    animation: scrapeProgress 1.4s infinite ease-in-out;
}

.scrape-progress span[data-product-progress-bar] {
    width: 0;
    min-width: 8px;
    transition: width .25s ease;
    animation: none;
}

.scrape-log {
    display: grid;
    gap: 6px;
    max-height: 130px;
    overflow: auto;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    color: #294245;
    font-size: 12px;
    line-height: 1.35;
}

.scrape-log li {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fcfb;
}

.scrape-log span {
    color: var(--muted);
    font-weight: 800;
}

.scrape-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 20px;
    color: #294245;
    font-size: 14px;
    font-weight: 800;
}

.location-status {
    margin-top: 6px !important;
}

@keyframes scrapePulse {
    0%,
    80%,
    100% {
        opacity: .35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

@keyframes scrapeProgress {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(250%);
    }
}

.login-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.login-card-head h2 {
    margin-bottom: 0;
    font-size: 32px;
}

.login-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 15px;
    color: var(--green);
    background: var(--soft);
    font-weight: 900;
}

.login-form label {
    margin-bottom: 18px;
}

.login-remember {
    margin-top: -4px;
    color: var(--muted);
}

.login-submit {
    width: 100%;
    min-height: 54px;
    justify-content: space-between;
    padding-inline: 20px;
    font-size: 17px;
}

.login-note {
    margin: 18px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

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

    .settings-grid > .form-card:nth-child(4) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .table-wrap {
        overflow-x: auto;
    }

    .product-prices-table {
        min-width: 920px;
    }

    .topbar,
    .account {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        align-items: stretch;
    }

    .clock-box {
        margin-left: 0;
    }

    .account {
        margin-left: 0;
    }

    .nav {
        left: 0;
        right: 0;
        min-width: auto;
    }

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

    .clearance-card {
        width: auto;
        margin-left: 0;
    }

    .settings-grid,
    .form-grid,
    .search-bar {
        grid-template-columns: 1fr;
    }

    .locations-table {
        min-width: 900px;
    }

    .favorite-row,
    .product-detail-head {
        grid-template-columns: 1fr;
    }

    .favorite-row img,
    .product-detail-head img {
        width: 110px;
        height: 110px;
    }

    .favorite-actions {
        grid-template-columns: 1fr 1fr;
    }

    .favorite-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-title {
        position: static;
        max-width: none;
        transform: none;
        order: 3;
    }

    .login-screen {
        background: linear-gradient(180deg, #0f4d45 0%, #166357 42%, #eef7f4 42.2%, #eef7f4 100%);
    }

    .login-shell {
        grid-template-columns: 1fr;
        gap: 22px;
        width: min(100% - 24px, 620px);
        min-height: auto;
        margin: 24px auto;
    }

    .login-logo {
        margin-bottom: 36px;
    }

    .login-brand-panel h1 {
        font-size: 48px;
    }
}
