* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f7;
    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: #182326;
    border: 1px solid #182326;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    height: 36px;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 16px;
}

.primary-action:hover {
    background: #0f191c;
}

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

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

.sidebar {
    background: #fbfcfc;
    border-right: 1px solid #dde5e7;
    padding: 24px 22px;
}

.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: 7px;
}

.sidebar-menu a {
    align-items: center;
    color: #1e2b2f;
    display: flex;
    font-size: 13px;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

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

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

.active-company {
    background: #f5f8f9;
    border: 1px solid #dce5e7;
    margin-top: 28px;
    padding: 14px 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%;
}

.logout-button:hover {
    background: #f1f5f6;
}

.panel-main {
    min-width: 0;
    padding: 26px 28px;
}

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

.page-header h1 {
    font-size: 21px;
    margin: 0 0 6px;
}

.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: 18px;
    grid-template-columns: minmax(520px, 2fr) minmax(300px, 1fr);
}

.panel-card {
    background: #fff;
    border: 1px solid #dfe7e9;
    box-shadow: 0 8px 22px rgba(17, 25, 28, .035);
    min-width: 0;
    padding: 18px;
}

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

.panel-card h2 {
    font-size: 17px;
    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%;
}

tbody tr:hover {
    background: #fbfdfd;
}

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

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

td {
    font-size: 13px;
    vertical-align: top;
}

td a {
    color: #294b59;
}

.status-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 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: 9px;
    margin-top: 16px;
}

.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: 36px;
    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 {
    max-width: 100%;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

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

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

.url-queue-table {
    min-width: 1120px;
}

.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: 300px;
}

.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;
}

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

.action-button.compact {
    min-width: auto;
}

.action-button.danger {
    border-color: #ecc0c0;
    color: #9a2424;
}

.action-button:hover {
    background: #eef3f5;
    border-color: #cbd8dc;
}

.action-button.danger:hover {
    background: #fff3f3;
    border-color: #dda8a8;
}

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

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

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

.notice {
    border: 1px solid;
    margin-bottom: 16px;
    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: 13px;
}

.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:focus,
.settings-form select:focus,
.settings-form textarea:focus,
.feed-link-cell input:focus {
    border-color: #8da4ac;
    outline: 2px solid rgba(141, 164, 172, .16);
}

.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;
}

.log-detail {
    max-width: 520px;
}

.log-detail summary {
    cursor: pointer;
    font-weight: 700;
}

.log-detail ul {
    background: #f8fafb;
    border: 1px solid #dfe6e9;
    list-style: none;
    margin: 8px 0 0;
    max-height: 320px;
    overflow: auto;
    padding: 10px 12px;
}

.log-detail li {
    border-bottom: 1px solid #e8eef1;
    font-size: 12px;
    line-height: 1.45;
    padding: 6px 0;
    white-space: normal;
    word-break: break-word;
}

.log-detail li:last-child {
    border-bottom: 0;
}

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

.stat-card {
    min-height: 86px;
    padding: 16px 18px;
}

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

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

.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(240px, 380px) minmax(280px, 1fr) auto auto;
}

.product-filter .primary-action,
.product-filter .secondary-action {
    height: 38px;
    white-space: nowrap;
}

.output-form {
    align-items: end;
    column-gap: 12px;
    row-gap: 10px;
    grid-template-columns: minmax(220px, 1.1fr) minmax(220px, 1.1fr) 145px 145px minmax(230px, 1fr) auto;
}

.output-create-card {
    margin-bottom: 16px;
    min-height: auto;
    padding-bottom: 14px;
}

.output-create-card .card-title-row {
    margin-bottom: 10px;
}

.output-form .primary-action {
    align-self: end;
    height: 38px;
    white-space: nowrap;
}

.outputs-table {
    min-width: 1240px;
}

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

.output-overview-card {
    margin-bottom: 16px;
}

.output-link-grid,
.source-output-grid {
    display: grid;
    gap: 12px;
}

.output-link-card,
.source-output-card {
    background: #fbfcfc;
    border: 1px solid #dce5e8;
    display: grid;
    gap: 10px;
    padding: 14px;
}

.output-link-card strong,
.source-output-card strong {
    color: #121b1f;
}

.source-output-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.source-output-heading,
.output-meta-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.source-output-heading small,
.output-link-card small,
.source-output-link small {
    color: #6c777b;
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.source-output-link {
    border-top: 1px solid #e4ecee;
    display: grid;
    gap: 8px;
    padding-top: 10px;
}

.output-link-line {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.output-link-line input {
    background: #fff;
    border: 1px solid #d6dee0;
    color: #172124;
    height: 36px;
    min-width: 0;
    padding: 0 10px;
    width: 100%;
}

.empty-output-state {
    background: #f6f8f8;
    border: 1px dashed #cad6d9;
    color: #667378;
    padding: 12px;
}

.feed-link-cell {
    min-width: 460px;
}

.feed-link-cell input {
    background: #fbfcfc;
    border: 1px solid #d6dee0;
    color: #172124;
    height: 36px;
    margin-right: 8px;
    padding: 0 10px;
    width: calc(100% - 58px);
}

.source-action-panel,
.output-action-panel {
    display: grid;
    gap: 8px;
}

.source-action-panel {
    min-width: 300px;
}

.output-action-panel {
    min-width: 250px;
}

.output-action-row,
.field-update-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.output-action-row form,
.field-update-actions form {
    margin: 0;
}

.field-update-menu {
    margin: 0;
}

.field-update-menu[open] {
    flex-basis: 100%;
}

.field-update-menu summary {
    list-style: none;
}

.field-update-menu summary::-webkit-details-marker {
    display: none;
}

.update-summary {
    min-width: 82px;
}

.resource-field-actions {
    background: #f8fafb;
    border: 1px solid #dfe7e9;
    margin-top: 6px;
    padding: 6px;
}

.icon-text-button,
.field-update-button {
    gap: 6px;
}

.button-icon {
    align-items: center;
    background: #edf3f5;
    border: 1px solid #d7e1e4;
    color: #33454b;
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    height: 18px;
    justify-content: center;
    line-height: 1;
    min-width: 18px;
}

.field-update-button {
    align-items: center;
    background: #fbfcfc;
    border: 1px solid #d8e0e2;
    color: #202a2d;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    height: 30px;
    justify-content: center;
    line-height: 1;
    padding: 0 8px;
    white-space: nowrap;
}

.field-update-button:hover {
    background: #eef3f5;
    border-color: #cbd8dc;
}

.full-update-button {
    background: #172124;
    border-color: #172124;
    color: #fff;
}

.full-update-button .button-icon {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .24);
    color: #fff;
}

.full-update-button:hover {
    background: #253237;
    border-color: #253237;
}

.output-checks {
    align-self: end;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-height: 38px;
    padding-bottom: 1px;
}

.output-checks label {
    background: #f6f9fa;
    border: 1px solid #dfe7e9;
    display: inline-flex;
    height: 38px;
    padding: 0 10px;
    white-space: nowrap;
}

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

.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;
}

.product-edit-layout {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.product-edit-form .card-title-row {
    margin-bottom: 4px;
}

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

.product-edit-grid .wide {
    grid-column: 1 / -1;
}

.product-description-input {
    min-height: 220px;
}

.images-textarea {
    min-height: 96px;
}

.settings-form .form-check {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    height: 16px;
    width: 16px;
}

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

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

.product-source-card {
    display: grid;
    gap: 14px;
}

.product-source-card p {
    color: #667277;
    font-size: 13px;
    margin: 6px 0 0;
}

.product-preview-image,
.product-preview-empty {
    background: #f4f7f8;
    border: 1px solid #dfe7e9;
    min-height: 220px;
    width: 100%;
}

.product-preview-image {
    max-height: 280px;
    object-fit: contain;
}

.product-preview-empty {
    align-items: center;
    color: #7b898e;
    display: flex;
    font-weight: 700;
    justify-content: center;
}

.source-meta-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.source-meta-list div {
    border-bottom: 1px solid #e6ecee;
    display: grid;
    gap: 4px;
    padding-bottom: 10px;
}

.source-meta-list dt {
    color: #68767b;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.source-meta-list dd {
    color: #172124;
    margin: 0;
    overflow-wrap: anywhere;
}

.raw-payload-block {
    display: grid;
    gap: 8px;
}

.raw-payload {
    background: #11191c;
    color: #dbe7ea;
    font-size: 11px;
    line-height: 1.5;
    margin: 0;
    max-height: 340px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

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

.status-scanned,
.status-imported,
.status-ready,
.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;
}

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

.inline-check input {
    height: 16px;
    width: 16px;
}

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

.ai-preview-block {
    border-top: 1px solid #e6ecee;
    display: grid;
    gap: 12px;
    padding-top: 14px;
}

.ai-description-preview {
    max-height: 260px;
}

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

.pagination-wrap nav,
.panel-pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.panel-pagination {
    justify-content: space-between;
}

.panel-pagination-summary {
    color: #607076;
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}

.panel-pagination-links {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.panel-page-link {
    align-items: center;
    background: #fff;
    border: 1px solid #d8e0e2;
    color: #202a2d;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 32px;
    justify-content: center;
    line-height: 1;
    min-width: 32px;
    padding: 0 9px;
}

.panel-page-link.text {
    min-width: 84px;
}

.panel-page-link:hover {
    background: #eef3f5;
    border-color: #cbd8dc;
}

.panel-page-link.active {
    background: #182326;
    border-color: #182326;
    color: #fff;
}

.panel-page-link.disabled,
.panel-page-link.ellipsis {
    background: #f5f8f9;
    color: #9aa6aa;
    cursor: default;
    pointer-events: none;
}

.pagination-wrap svg {
    display: block;
    height: 14px;
    width: 14px;
}

.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,
    .output-form,
    .product-edit-layout,
    .product-edit-grid,
    .form-row {
        grid-template-columns: 1fr;
    }
}
