* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f8f4;
    color: #11191c;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

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

.login-screen {
    align-items: center;
    background: #f3f4f0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #f7f8f5;
    border: 1px solid #d9dfdf;
    box-shadow: 0 4px 16px rgba(17, 25, 28, .08);
    min-height: 210px;
    padding: 20px 18px 16px;
    text-align: center;
    width: 280px;
}

.brand-mark {
    align-items: center;
    background: #202a2d;
    color: #fff;
    display: inline-flex;
    font-size: 15px;
    font-weight: 700;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.login-card h1 {
    font-size: 17px;
    margin: 13px 0 4px;
}

.login-card p {
    color: #647074;
    font-size: 11px;
    margin: 0 0 14px;
}

.login-form {
    display: grid;
    gap: 8px;
    text-align: left;
}

.login-form label {
    position: relative;
}

.login-form span {
    color: #536065;
    font-size: 11px;
    left: 11px;
    line-height: 1;
    position: absolute;
    top: 7px;
}

.login-form input {
    background: #f9fbfb;
    border: 1px solid #cdd6d8;
    color: #182124;
    height: 36px;
    padding: 17px 38px 5px 11px;
    width: 100%;
}

.login-form label::after {
    background: #a8b0b3;
    color: #fff;
    content: "...";
    display: block;
    font-size: 10px;
    height: 18px;
    line-height: 13px;
    position: absolute;
    right: 9px;
    text-align: center;
    top: 9px;
    width: 18px;
}

.login-form button,
.primary-action {
    background: #202a2d;
    border: 1px solid #202a2d;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    line-height: 32px;
    padding: 0 16px;
}

.form-error {
    background: #fff2f2;
    border: 1px solid #f0b8b8;
    color: #9b1c1c;
    font-size: 12px;
    padding: 8px;
}

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

.sidebar {
    background: #f8faf9;
    border-right: 1px solid #e2e7e4;
    padding: 26px 24px;
}

.sidebar-brand {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.sidebar-brand strong {
    display: block;
    font-size: 18px;
}

.sidebar-brand small {
    color: #657075;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.sidebar-menu {
    display: grid;
    gap: 6px;
}

.sidebar-menu a {
    align-items: center;
    color: #1e2b2f;
    display: flex;
    font-size: 13px;
    gap: 10px;
    height: 38px;
    padding: 0 12px;
}

.sidebar-menu a.active,
.sidebar-menu a:hover {
    background: #eef3f5;
    border: 1px solid #d9e1e4;
}

.sidebar-menu span {
    color: #0f1a1e;
    display: inline-block;
    font-weight: 700;
    text-align: center;
    width: 18px;
}

.active-company {
    background: #f3f7f8;
    border: 1px solid #dce5e7;
    margin-top: 30px;
    padding: 15px 13px;
}

.active-company span {
    color: #657075;
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
}

.active-company strong {
    display: block;
}

.logout-button {
    background: #fff;
    border: 1px solid #d5dcde;
    cursor: pointer;
    font-weight: 700;
    height: 38px;
    margin-top: 16px;
    width: 100%;
}

.panel-main {
    padding: 28px 30px;
}

.page-header {
    align-items: center;
    background: #fff;
    border: 1px solid #e0e5e1;
    box-shadow: 0 2px 10px rgba(17, 25, 28, .04);
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    min-height: 92px;
    padding: 22px 20px;
}

.page-header h1 {
    font-size: 22px;
    margin: 0 0 7px;
}

.page-header p {
    color: #5e6a6e;
    font-size: 13px;
    margin: 0;
}

.page-header select {
    background: #fff;
    border: 1px solid #dce3e5;
    height: 38px;
    padding: 0 12px;
}

.dashboard-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(520px, 2fr) minmax(300px, 1fr);
}

.panel-card {
    background: #fff;
    border: 1px solid #e0e5e1;
    box-shadow: 0 2px 10px rgba(17, 25, 28, .04);
    padding: 20px;
}

.card-title-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.panel-card h2 {
    font-size: 18px;
    margin: 0;
}

.card-title-row span {
    background: #f0f5f7;
    border: 1px solid #dbe4e6;
    color: #465257;
    font-size: 12px;
    padding: 5px 9px;
}

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

th {
    background: #f6f9fa;
    color: #3b494e;
    font-size: 12px;
    text-align: left;
}

th,
td {
    border-bottom: 1px solid #edf1f2;
    padding: 13px 14px;
}

td {
    font-size: 13px;
}

td a {
    color: #294b59;
}

.status-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
}

.status-pill.active {
    background: #c9f7d6;
    color: #0f7133;
}

.status-pill.passive {
    background: #f4d7d7;
    color: #8b2020;
}

.quick-card {
    min-height: 176px;
}

.quick-card p {
    color: #5e6a6e;
    margin: 10px 0 16px;
}

.quick-card small {
    color: #6d787c;
    display: block;
    margin-top: 17px;
}

.empty-state {
    max-width: 720px;
}

.empty-state p {
    color: #5e6a6e;
    margin-bottom: 0;
}

.sources-header {
    align-items: flex-start;
}

.header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.header-actions form {
    margin: 0;
}

.secondary-action {
    align-items: center;
    background: #fff;
    border: 1px solid #d8e0e2;
    color: #202a2d;
    cursor: pointer;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    padding: 0 13px;
}

.sources-card {
    padding: 18px 20px 22px;
}

.table-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.table-actions span {
    background: #f0f5f7;
    border: 1px solid #dbe4e6;
    color: #465257;
    font-size: 12px;
    padding: 8px 10px;
}

.responsive-table {
    overflow-x: auto;
}

.sources-table {
    min-width: 980px;
}

.sources-table.advanced {
    min-width: 1320px;
}

.sources-table small {
    color: #6c777b;
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.sources-table th:nth-child(1),
.sources-table td:nth-child(1) {
    width: 150px;
}

.sources-table th:nth-child(2),
.sources-table td:nth-child(2) {
    width: 130px;
}

.sources-table th:nth-child(4),
.sources-table td:nth-child(4) {
    width: 150px;
}

.sources-table th:nth-child(5),
.sources-table td:nth-child(5) {
    width: 100px;
}

.sources-table th:nth-child(6),
.sources-table td:nth-child(6) {
    width: 130px;
}

.url-cell {
    color: #2c4853;
    max-width: 580px;
    overflow-wrap: anywhere;
}

.row-actions {
    display: flex;
    gap: 6px;
}

.stacked-actions {
    flex-wrap: wrap;
    min-width: 180px;
}

.row-actions form {
    margin: 0;
}

.icon-button {
    align-items: center;
    background: #fff;
    border: 1px solid #d8e0e2;
    color: #202a2d;
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 700;
    height: 32px;
    justify-content: center;
    line-height: 1;
    min-width: 32px;
    padding: 0;
}

.icon-button:hover,
.secondary-action:hover {
    background: #eef3f5;
}

.status-note,
.error-note {
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.error-note {
    color: #9a2a2a;
}

.notice {
    border: 1px solid;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.notice.success {
    background: #ecfff1;
    border-color: #b8e8c5;
    color: #156b34;
}

.notice.error {
    background: #fff3f3;
    border-color: #ecc0c0;
    color: #8d2424;
}

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

.settings-card {
    min-height: 100%;
}

.settings-card h2 {
    margin-bottom: 8px;
}

.card-description {
    color: #5e6a6e;
    margin: 0 0 18px;
}

.settings-form {
    display: grid;
    gap: 14px;
}

.settings-form label {
    display: grid;
    gap: 7px;
}

.settings-form span {
    color: #3b494e;
    font-size: 12px;
    font-weight: 700;
}

.settings-form input,
.settings-form select,
.settings-form textarea,
.sources-table input,
.sources-table select {
    background: #fbfcfc;
    border: 1px solid #d6dee0;
    color: #172124;
    padding: 0 11px;
    width: 100%;
}

.settings-form input,
.settings-form select,
.sources-table input,
.sources-table select {
    height: 38px;
}

.settings-form textarea {
    min-height: 112px;
    padding: 10px 11px;
    resize: vertical;
}

.wide-form {
    max-width: 980px;
}

.check-row {
    align-content: center;
    display: grid;
    gap: 10px;
}

.check-row label {
    align-items: center;
    display: flex;
    gap: 8px;
}

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

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

.inline-import-form {
    margin-top: 14px;
}

.log-filter-card {
    margin-bottom: 18px;
}

.compact-filter {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 420px) auto;
}

.log-table {
    min-width: 1180px;
}

.stats-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    margin-bottom: 18px;
}

.stat-card {
    min-height: 92px;
}

.stat-card span {
    color: #657075;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 10px;
}

.stat-card strong {
    display: block;
    font-size: 28px;
}

.crawler-box {
    background: #f7fafb;
    border: 1px solid #dfe7e9;
    display: grid;
    gap: 14px;
    padding: 16px;
}

.crawler-box h2 {
    font-size: 16px;
    margin: 0;
}

.url-filter {
    align-items: end;
    grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
}

.product-filter {
    align-items: end;
    grid-template-columns: minmax(220px, 360px) minmax(280px, 1fr) auto;
}

.products-table {
    min-width: 1280px;
}

.products-table small {
    color: #6c777b;
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.product-thumb {
    background: #f0f4f5;
    border: 1px solid #dce4e6;
    display: block;
    height: 54px;
    object-fit: contain;
    width: 54px;
}

.product-thumb.empty {
    color: #829096;
    line-height: 52px;
    text-align: center;
}

.status-pending {
    background: #eef3f5;
    color: #44545a;
}

.status-scanned,
.status-imported,
.status-in_stock {
    background: #c9f7d6;
    color: #0f7133;
}

.status-failed,
.status-out_of_stock {
    background: #f4d7d7;
    color: #8b2020;
}

.status-skipped,
.status-unknown {
    background: #f5ecd4;
    color: #7b5d13;
}

.pagination-wrap {
    margin-top: 18px;
}

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

.settings-summary {
    display: grid;
    gap: 12px;
    margin: 0;
}

.settings-summary div {
    background: #f7fafb;
    border: 1px solid #e0e7e9;
    display: grid;
    gap: 5px;
    padding: 12px;
}

.settings-summary dt {
    color: #657075;
    font-size: 12px;
    font-weight: 700;
}

.settings-summary dd {
    margin: 0;
}

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

    .sidebar {
        border-bottom: 1px solid #e2e7e4;
        border-right: 0;
    }

    .dashboard-grid,
    .page-header {
        display: block;
    }

    .page-header select {
        margin-top: 16px;
        width: 100%;
    }

    .settings-grid,
    .stats-grid,
    .url-filter,
    .product-filter,
    .form-row {
        grid-template-columns: 1fr;
    }
}
