:root {
    --primary: #0066cc;
    --primary-dark: #004d99;
    --accent: #ff9900;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --bg: #f0f4f8;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 10px;
    --nav-height: 60px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}

.brand-copy {
    display: grid;
    gap: 0.05rem;
    line-height: 1.1;
}

.brand-text {
    font-size: 1.05rem;
}

.brand-tagline {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.brand:hover {
    text-decoration: none;
    opacity: 0.9;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-button {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    font: inherit;
}

.signout-form {
    margin: 0;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
}

/* Workflow bar */
.workflow-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
}

.workflow-steps {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.workflow-step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-decoration: none;
}

.workflow-step:hover {
    text-decoration: none;
    color: var(--primary);
}

.workflow-step.current {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.workflow-step.done {
    color: var(--success);
}

.workflow-step .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.75rem;
    font-weight: 700;
}

.workflow-step.current .step-num {
    background: rgba(255, 255, 255, 0.25);
}

.workflow-arrow {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Main content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sample-hint {
    margin: -0.5rem 0 1rem;
}

.sample-hint a {
    font-weight: 600;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}

.subtitle {
    margin: 0;
    color: var(--text-muted);
}

.auth-shell {
    min-height: calc(100vh - var(--nav-height) - 9rem);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.auth-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.auth-form .btn {
    justify-content: center;
}

.auth-switch {
    margin: 1rem 0 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.alert {
    margin-top: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9375rem;
}

.alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.card-header-row h2 {
    margin: 0;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.loading-card {
    opacity: 0.6;
}

.stat-date-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 6.75rem;
}

.stat-date-card .stat-label {
    margin-top: 0.45rem;
    margin-bottom: 0;
}

.stat-date-main {
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.stat-date-sub,
.stat-date-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.25;
    white-space: nowrap;
}

.stat-date-empty {
    margin-bottom: 0.1rem;
}

.social-platform-grid {
    display: grid;
    grid-template-columns: repeat(6, 3rem);
    gap: 0.85rem;
    align-items: center;
    justify-content: start;
    align-content: center;
    padding-top: 0.15rem;
    min-height: 5rem;
}

.social-platform-card {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    width: 3rem;
    height: 3rem;
    min-width: 0;
}

.social-platform-card::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    z-index: 20;
    transform: translateX(-50%);
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    background: #111827;
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
}

.social-platform-card:hover::after {
    opacity: 1;
}

.social-platform-card.inactive {
    opacity: 0.55;
}

.social-platform-card.connected {
    background: transparent;
    box-shadow: none;
}

.social-platform-icon-wrap {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.social-platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--text-muted);
    color: white;
    font-size: 0.95rem;
    font-weight: 800;
}

.social-platform-check {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: #16a34a;
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 900;
    line-height: 1;
}

.social-youtube { background: #ff0000; }
.social-facebook { background: #1877f2; }
.social-instagram { background: #c13584; }
.social-linkedin_page,
.social-linkedin_personal { background: #0a66c2; }
.social-x { background: #000000; }

.dashboard-alert-card {
    padding-bottom: 1.25rem;
}

.dashboard-work-grid {
    display: grid;
    grid-template-columns: minmax(0, 4.5fr) minmax(0, 5.5fr);
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1.25rem;
}

.dashboard-work-grid .card {
    min-width: 0;
    height: 100%;
}

.updated-products-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.updated-products-summary-card {
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
}

.updated-products-summary-card strong,
.updated-products-summary-card span {
    display: block;
}

.updated-products-summary-card strong {
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
}

.updated-products-summary-card span {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.updated-products-summary-card span b {
    margin-right: 0.25rem;
}

.updated-products-summary-card.increased span b {
    color: var(--success);
}

.updated-products-summary-card.decreased span b {
    color: var(--error);
}

.updated-products-summary-card.products strong {
    color: var(--primary);
}

.updated-products-summary-card.increased strong {
    color: var(--success);
}

.updated-products-summary-card.decreased strong {
    color: var(--error);
}

.updated-products-summary-card.no-change strong {
    color: var(--text-muted);
}

.today-generation-summary {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-left: auto;
}

.today-generation-summary div {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
}

.today-generation-summary strong {
    color: var(--primary);
    font-size: 0.9375rem;
    white-space: nowrap;
}

.today-generation-summary span {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.generation-reason {
    max-width: 22rem;
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.country-shipment-cell {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.country-shipment-cell strong,
.country-shipment-cell small {
    overflow-wrap: anywhere;
}

.country-shipment-cell strong {
    font-size: 0.875rem;
}

.country-shipment-cell small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.today-generation-table {
    font-size: 0.8125rem;
}

.dashboard-generation-actions {
    justify-content: flex-start;
}

.share-status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 18rem;
}

.share-status-list a {
    text-decoration: none;
}

.share-status-summary {
    display: grid;
    gap: 0.15rem;
    min-width: 8rem;
    max-width: 13rem;
}

.share-status-line {
    display: grid;
    gap: 0.05rem;
    font-size: 0.75rem;
    line-height: 1.25;
}

.share-status-line strong {
    font-size: 0.7rem;
}

.share-status-line span {
    min-width: 0;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.share-status-line.published strong {
    color: var(--success);
}

.share-status-line.failed strong {
    color: var(--error);
}

.share-status-line.pending strong {
    color: #92400e;
}

.share-status-chip,
.share-status-empty {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.share-status-chip.published {
    color: #166534;
    background: #dcfce7;
}

.share-status-chip.failed {
    color: #991b1b;
    background: #fee2e2;
}

.share-status-chip.pending {
    color: #92400e;
    background: #fef3c7;
}

.share-status-empty {
    color: var(--text-muted);
    background: #f3f4f6;
}

.inline-link {
    margin-left: 0.5rem;
    font-weight: 600;
}

/* Action grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-card {
    display: block;
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
}

.action-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.action-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.action-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e1;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
    text-decoration: none;
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
}

.btn-compact {
    padding: 0.35rem 0.7rem;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    gap: 0;
}

.btn-icon svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}

.icon-action-btn:hover {
    color: var(--primary-dark);
}

.icon-action-btn svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Forms */
.input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9375rem;
    transition: border-color 0.15s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.textarea {
    resize: vertical;
    min-height: 5rem;
}

.social-description-textarea {
    min-height: 18rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.company-details-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.company-assets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.single-field-grid {
    max-width: 420px;
    margin: 0 auto;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.sticky-actions {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.file-picker-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.country-flag-preview {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.company-asset-field {
    display: grid;
    gap: 0.5rem;
}

.company-asset-preview {
    width: 100%;
    height: 5.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.company-asset-img {
    max-width: 100%;
    max-height: 4.75rem;
    object-fit: contain;
}

.company-asset-empty {
    min-height: 4rem;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.status-active {
    color: #166534;
    background: #dcfce7;
}

.status-inactive {
    color: #6b7280;
    background: #f3f4f6;
}

.social-connection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.social-app-config-grid {
    display: grid;
    gap: 0.9rem;
}

.social-app-config-item {
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.social-app-config-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.social-app-config-header h3 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.2;
}

.social-app-config-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.social-app-config-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.social-connection-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.65rem 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

.social-connection-copy {
    min-width: 0;
}

.social-connection-copy strong {
    display: block;
    font-size: 0.9375rem;
    line-height: 1.2;
}

.social-connection-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.social-connection-copy p {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.social-platform-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: start;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
}

.social-platform-mark.social-youtube {
    background: #dc2626;
}

.social-platform-mark.social-facebook {
    background: #1877f2;
}

.social-platform-mark.social-instagram {
    background: #c13584;
}

.social-platform-mark.social-x {
    background: #111827;
}

.social-platform-mark.social-linkedin {
    background: #0a66c2;
}

.social-connection-row .file-action-row {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

/* Upload zone */
.import-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.import-method-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    min-height: 13rem;
    padding: 2.25rem 1.5rem;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.upload-content {
    max-width: 42rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(0, 102, 204, 0.04);
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    height: 2.25rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    background: rgba(0, 102, 204, 0.08);
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.selected-file {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 102, 204, 0.08);
    border-radius: 6px;
    font-size: 0.875rem;
}

@media (max-width: 760px) {
    .import-method-grid {
        grid-template-columns: 1fr;
    }
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: rgba(0, 102, 204, 0.03);
}

.data-table tbody tr.large-change-row {
    background: #fef2f2;
}

.data-table tbody tr.large-change-row:hover {
    background: #fee2e2;
}

.compact-data-table {
    font-size: 0.875rem;
}

.compact-data-table th,
.compact-data-table td {
    padding: 0.45rem 0.65rem;
}

.compact-data-table th {
    font-size: 0.75rem;
}

.job-updated {
    white-space: nowrap;
}

.product-thumb-btn {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.product-thumb-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

.product-thumb {
    display: inline-flex;
    width: 64px;
    height: 44px;
    object-fit: cover;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.6875rem;
    line-height: 1.1;
    text-align: center;
}

.product-thumb-btn:hover .product-thumb {
    border-color: var(--primary);
}

.country-logo-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 220px;
}

.country-logo-img,
.country-logo-empty {
    width: 64px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
}

.country-logo-img {
    object-fit: contain;
}

.country-logo-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-align: center;
}

.country-logo-path {
    color: var(--text-muted);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.data-table .editable {
    cursor: pointer;
    border-bottom: 1px dashed var(--primary);
}

.data-table .editable:hover {
    background: rgba(0, 102, 204, 0.06);
}

.inline-input {
    width: 100%;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--primary);
    border-radius: 4px;
    font-size: inherit;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
}

.badge-success {
    background: #dcfce7;
    color: var(--success);
}

.badge-error {
    background: #fee2e2;
    color: var(--error);
}

.badge-warning {
    background: #fef3c7;
    color: var(--warning);
}

.preview-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Rate change colors */
.rate-up {
    color: var(--success);
    font-weight: 600;
}

.rate-down {
    color: var(--error);
    font-weight: 600;
}

.rate-large {
    color: var(--error);
    font-weight: 700;
}

.rate-neutral {
    color: var(--text-muted);
}

/* Error list */
.error-list {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--error);
}

.error-list ul {
    margin: 0;
    padding-left: 1.25rem;
}

/* Generate page */
.generate-card {
    text-align: center;
}

.generate-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.status-icon {
    font-size: 3rem;
}

.status-info h2 {
    margin: 0 0 0.25rem;
}

.status-info p {
    margin: 0;
}

.generate-actions {
    justify-content: center;
}

.file-action-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.generated-date,
.generated-time {
    display: block;
    white-space: nowrap;
}

.generated-time {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.generate-filter-grid {
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(260px, 1.35fr);
    align-items: start;
    text-align: left;
}

.audio-field .file-picker-row {
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.audio-field .text-muted {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-rights-row {
    margin-top: 0.5rem;
    align-items: flex-start;
    line-height: 1.35;
}

.background-audio-preview {
    width: 100%;
    height: 36px;
    margin-top: 0.5rem;
}

@media (max-width: 900px) {
    .generate-filter-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .audio-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .generate-filter-grid {
        grid-template-columns: 1fr;
    }
}

.mp4-preview {
    display: block;
    width: 100%;
    max-height: 70vh;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.progress-wrap {
    margin: 1.5rem 0;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.latest-info {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9375rem;
}

.modal.share-modal {
    width: 90vw;
    max-width: 90vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal.share-modal .modal-header {
    flex: 0 0 auto;
}

.share-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
    gap: 1.25rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.share-compose-column,
.share-publish-column {
    display: grid;
    gap: 1rem;
    min-width: 0;
    align-content: start;
}

.share-compose-column {
    min-height: 0;
}

.share-publish-column {
    max-height: calc(90vh - 6.5rem);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.share-title-grid {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
    align-items: end;
}

.share-file-name {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.share-actions,
.share-platform-grid {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.share-description {
    min-height: calc(90vh - 18rem);
    resize: vertical;
}

.share-status-note {
    min-height: 1.25rem;
    margin: 0;
}

.share-platform-btn {
    width: 100%;
}

.youtube-publish-box {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
}

.youtube-publish-box h3 {
    margin: 0;
    font-size: 1rem;
}

.youtube-publish-box .card-header-row {
    margin-bottom: 0;
}

.youtube-publish-box .btn {
    width: 100%;
    justify-content: center;
}

@media (max-width: 900px) {
    .modal.share-modal {
        width: 94vw;
        max-width: 94vw;
    }

    .share-panel {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .share-publish-column {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .share-title-grid {
        grid-template-columns: 1fr;
    }

    .share-description {
        min-height: 18rem;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.duplicate-generation-modal {
    max-width: 600px;
}

.duplicate-warning-content {
    display: grid;
    gap: 0.75rem;
}

.duplicate-warning-content p {
    margin: 0;
}

.duplicate-existing-file {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.image-preview-modal {
    max-width: min(920px, calc(100vw - 2rem));
}

.image-preview-img {
    display: block;
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 6px;
    background: var(--bg);
}

.image-preview-empty {
    min-height: 220px;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
}

.pexels-search-panel {
    margin-top: 1rem;
    display: grid;
    gap: 0.75rem;
}

.pexels-search-panel label {
    font-weight: 600;
    color: var(--text);
}

.pexels-image-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 0.75rem;
}

.pexels-image-option {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    overflow: hidden;
    display: grid;
    gap: 0.5rem;
    padding: 0.5rem;
}

.pexels-image-option img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg);
}

.pexels-image-option .btn {
    width: 100%;
}

.pexels-image-credit {
    min-height: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 0.75rem);
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
    width: calc(100% - 2rem);
}

.toast {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9375rem;
    animation: slideIn 0.25s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.toast-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.toast-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.toast-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.toast-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility */
.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
}

.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border);
}

.footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: var(--shadow-lg);
    }

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

    .workflow-arrow {
        display: none;
    }

    .workflow-steps {
        gap: 0.35rem;
    }

    .page-header {
        flex-direction: column;
    }

    .dashboard-work-grid {
        grid-template-columns: 1fr;
    }

    .social-platform-grid {
        grid-template-columns: repeat(auto-fit, 3rem);
    }

    .updated-products-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-table {
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.6rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

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

    .social-app-config-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .company-details-grid {
        grid-template-columns: 1fr;
    }

    .company-assets-grid {
        grid-template-columns: 1fr;
    }

    .social-app-config-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 1rem 0.75rem 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .updated-products-summary-grid {
        grid-template-columns: 1fr;
    }

}
