:root {
    --page-bg: #f4f7f3;
    --panel-bg: #ffffff;
    --text-main: #1f2a24;
    --text-muted: #647067;
    --border-soft: #dfe7dc;
    --brand: #4f6f3f;
    --brand-dark: #35522b;
    --working-bg: #e7f5e4;
    --working-text: #27632a;
    --planned-bg: #f2eee3;
    --planned-text: #7a5b20;
    --disabled-bg: #e6e6e6;
    --disabled-text: #777777;
    --shadow-soft: 0 10px 30px rgba(31, 42, 36, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page-bg);
    color: var(--text-main);
}

.page-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
}

.top-bar h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.1;
    color: var(--brand-dark);
}

.page-subtitle {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 15px;
}

.user-area {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.user-name {
    color: var(--text-muted);
    font-size: 14px;
}

.user-name strong {
    color: var(--text-main);
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    background: var(--panel-bg);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.hero-panel h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.hero-panel p {
    margin: 0;
    color: var(--text-muted);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-compact-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
    margin-bottom: 24px;
}

.dpd-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    margin-bottom: 24px;
}

.dpd-info-grid .dashboard-card,
.dpd-info-notice {
    min-width: 0;
    min-height: 0;
}

.dpd-info-notice {
    margin-bottom: 16px;
}

.dpd-info-card-full {
    grid-column: 1 / -1;
}

.dpd-info-card-wide {
    grid-column: span 2;
}

.dpd-info-upload-form {
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.dpd-info-upload-form input[type="file"] {
    width: 100%;
    margin-top: 8px;
}

.dpd-info-upload-form .card-actions {
    margin-top: auto;
    padding-top: 18px;
}

.dpd-info-table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.dpd-parcel-card {
    grid-column: 1 / -1;
    min-width: 0;
}

.dpd-parcel-card .card-body {
    min-width: 0;
}

.dpd-parcel-filter-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8faf7;
}

.dpd-filter-field {
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.dpd-filter-field input {
    min-width: 165px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-main);
    font: inherit;
}

.dpd-filter-field input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 111, 63, 0.12);
    outline: none;
}

.dpd-parcel-filter-form .button {
    min-height: 40px;
}

.dpd-parcel-errors {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #efc7c7;
    border-radius: 10px;
    background: #fff5f5;
    color: #8a2525;
}

.dpd-parcel-errors p {
    margin: 0;
    color: inherit;
}

.dpd-parcel-errors p + p {
    margin-top: 6px;
}

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

.dpd-parcel-summary-item {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8faf7;
}

.dpd-parcel-summary-item span,
.dpd-parcel-summary-item strong {
    display: block;
}

.dpd-parcel-summary-item span {
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.dpd-parcel-summary-item strong {
    overflow-wrap: anywhere;
    color: var(--brand-dark);
    font-size: 18px;
    line-height: 1.2;
}

.dpd-parcel-card .dpd-info-table-wrap {
    max-height: 600px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    overflow: auto;
}

.dpd-parcel-table {
    width: 100%;
    min-width: 1240px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.dpd-parcel-table th,
.dpd-parcel-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-soft);
    background: #ffffff;
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.dpd-parcel-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f3f7f1;
    color: var(--brand-dark);
    font-weight: 700;
    box-shadow: 0 1px 0 var(--border-soft);
}

.dpd-parcel-table tbody tr:last-child td {
    border-bottom: 0;
}

.dpd-parcel-table tbody tr:nth-child(even) td {
    background: #fbfcfa;
}

.dpd-parcel-table tbody tr:hover td {
    background: #f3f7f1;
}

.dpd-parcel-table th:nth-child(1),
.dpd-parcel-table td:nth-child(1) {
    min-width: 105px;
}

.dpd-parcel-table th:nth-child(2),
.dpd-parcel-table td:nth-child(2) {
    min-width: 120px;
}

.dpd-parcel-table th:nth-child(3),
.dpd-parcel-table td:nth-child(3) {
    min-width: 100px;
}

.dpd-parcel-table th:nth-child(4),
.dpd-parcel-table td:nth-child(4) {
    min-width: 125px;
}

.dpd-parcel-table th:nth-child(5),
.dpd-parcel-table td:nth-child(5) {
    min-width: 110px;
}

.dpd-parcel-table th:nth-child(6),
.dpd-parcel-table td:nth-child(6) {
    width: 80px;
    text-align: right;
}

.dpd-parcel-table th:nth-child(7),
.dpd-parcel-table td:nth-child(7) {
    min-width: 300px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.dpd-parcel-table th:nth-child(8),
.dpd-parcel-table td:nth-child(8),
.dpd-parcel-table th:nth-child(9),
.dpd-parcel-table td:nth-child(9) {
    min-width: 105px;
    text-align: right;
}

.dpd-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    line-height: inherit;
    text-align: inherit;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
}

.dpd-parcel-table th:nth-child(6) .dpd-sort-button,
.dpd-parcel-table th:nth-child(8) .dpd-sort-button,
.dpd-parcel-table th:nth-child(9) .dpd-sort-button {
    justify-content: flex-end;
}

.dpd-sort-button:hover,
.dpd-sort-button:focus-visible {
    color: var(--brand);
    outline: none;
}

.dpd-sort-indicator {
    flex: 0 0 12px;
    min-width: 12px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.dashboard-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    min-height: 210px;
    display: flex;
    flex-direction: column;
}

.dashboard-compact-grid .dashboard-card {
    min-height: 0;
    padding: 14px;
    border-radius: 14px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.dashboard-compact-grid .card-header {
    gap: 8px;
    margin-bottom: 12px;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
}

.dashboard-compact-grid .card-header h3 {
    font-size: 17px;
    line-height: 1.2;
}

.card-body {
    flex: 1;
}

.dashboard-compact-grid .card-body {
    flex: 1;
}

.card-actions {
    margin-top: 18px;
    display: flex;
    align-items: flex-end;
}

.dashboard-compact-grid .card-actions {
    margin-top: 14px;
}

.dashboard-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.compact-card-text {
    font-size: 14px;
    line-height: 1.45;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.status-ready {
    background: #e6f4ea;
    color: #1f6b35;
}

.status-working {
    background: #fff4d6;
    color: #8a5a00;
}

.status-error {
    background: #fde8e8;
    color: #9b1c1c;
}

.dashboard-compact-grid .status-badge {
    padding: 5px 9px;
    font-size: 11px;
}

.status-working {
    background: var(--working-bg);
    color: var(--working-text);
}

.status-planned {
    background: var(--planned-bg);
    color: var(--planned-text);
}

.status-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.status-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
}

.dashboard-compact-grid .status-list li {
    padding: 7px 0;
    gap: 8px;
    font-size: 12px;
}

.status-list li:first-child {
    padding-top: 0;
}

.status-list li:last-child {
    border-bottom: 0;
}

.status-list span {
    color: var(--text-muted);
}

.status-list strong {
    text-align: right;
    color: var(--text-main);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 0;
    background: var(--brand);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.dashboard-compact-grid .button {
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 13px;
}

.button:hover {
    background: var(--brand-dark);
}

.button:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}

.button-secondary {
    background: var(--brand);
    color: #ffffff;
}

.button-secondary:hover {
    background: var(--brand-dark);
}

.button-disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}

.button-disabled:hover {
    background: var(--disabled-bg);
}


.build-notes {
    background: var(--panel-bg);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
}

.build-notes h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.build-notes ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 13px;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-panel {
    width: min(440px, 100%);
    background: var(--panel-bg);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--shadow-soft);
}

.login-header {
    margin-bottom: 24px;
}

.login-header h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1.1;
    color: var(--brand-dark);
}

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

.login-form {
    margin: 0;
}

.form-row {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-main);
    font-size: 15px;
    font-family: Arial, Helvetica, sans-serif;
}

.form-input:focus {
    outline: 2px solid rgba(79, 111, 63, 0.2);
    border-color: var(--brand);
}

.form-actions {
    margin-top: 20px;
}

.form-actions .button {
    width: 100%;
}

.message-error,
.message-info {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.message-error {
    background: #fdeaea;
    border: 1px solid #f3c1c1;
    color: #8a2525;
}

.message-info {
    background: #edf5ff;
    border: 1px solid #c8def5;
    color: #264f78;
}

.message-error ul {
    margin: 0;
    padding-left: 20px;
}


.sql-runner-card {
    margin-bottom: 18px;
}

.sql-runner-form {
    margin: 0;
}

.sql-textarea {
    width: 100%;
    min-height: 220px;
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-main);
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.sql-textarea:focus {
    outline: 2px solid rgba(79, 111, 63, 0.2);
    border-color: var(--brand);
}

.sql-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.sql-message-panel {
    margin-bottom: 18px;
}

.sql-results-card {
    margin-bottom: 24px;
}

.sql-result-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.sql-results-wrapper {
    width: 100%;
    overflow-x: auto;
}

.sql-empty-state {
    margin: 0;
    color: var(--text-muted);
}

.sql-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sql-results-table th,
.sql-results-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.sql-results-table th {
    background: #f8faf7;
    color: var(--brand-dark);
    font-weight: 700;
    position: sticky;
    top: 0;
}

.sql-results-table td {
    color: var(--text-main);
}

.sql-null-value {
    color: var(--text-muted);
    font-style: italic;
}

.sql-history-card {
    margin-bottom: 24px;
}

.sql-history-wrapper {
    width: 100%;
    overflow: hidden;
}

.sql-history-item {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    background: #f8faf7;
    overflow: hidden;
}

.sql-history-item:last-child {
    margin-bottom: 0;
}

.sql-history-topline {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.sql-history-title-block {
    min-width: 0;
    flex: 1;
}

.sql-history-title {
    display: block;
    margin-bottom: 5px;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.sql-history-meta {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.sql-history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
}

.sql-history-actions .button {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 13px;
}

.sql-history-section-label {
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sql-history-sql {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text-main);
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sql-history-details {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #ffffff;
}

.sql-history-detail {
    min-width: 150px;
}

.sql-history-detail span {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.sql-history-detail strong {
    display: block;
    color: var(--text-main);
    font-size: 14px;
}

.sql-history-error {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #f3c1c1;
    border-radius: 12px;
    background: #fdeaea;
    color: #8a2525;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sql-history-error strong {
    display: block;
    margin-bottom: 5px;
}

.sql-rules-card {
    margin-bottom: 24px;
}

.sql-rules-copy-block {
    width: 100%;
    max-width: 100%;
    min-height: 520px;
    max-height: 720px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8faf7;
    color: var(--text-main);
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 1100px) {
    .dashboard-compact-grid,
    .dpd-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

@media (max-width: 680px) {
    .page-shell {
        width: min(100% - 20px, 1440px);
        padding-top: 14px;
    }

    .top-bar,
    .hero-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-area {
        justify-content: flex-start;
    }

    .card-grid,
    .dashboard-compact-grid,
    .dpd-info-grid {
        grid-template-columns: 1fr;
    }

    .dpd-info-card-wide {
        grid-column: 1;
    }

    .dpd-parcel-summary {
        grid-template-columns: 1fr;
    }

    .dpd-parcel-filter-form {
        align-items: stretch;
    }

    .dpd-filter-field,
    .dpd-parcel-filter-form .button {
        width: 100%;
    }

    .top-bar h1 {
        font-size: 28px;
    }

    .login-shell {
        align-items: flex-start;
        padding-top: 32px;
    }

    .login-panel {
        padding: 22px;
    }

    .login-header h1 {
        font-size: 28px;
    }

    .sql-actions {
        flex-direction: column;
    }

    .sql-actions .button {
        width: 100%;
    }

    .sql-history-topline {
        flex-direction: column;
    }

    .sql-history-actions {
        justify-content: flex-start;
    }

    .sql-history-actions .button {
        flex: 1;
    }

    .sql-history-details {
        flex-direction: column;
    }

    .sql-history-detail {
        min-width: 0;
    }
}

/* ZAK account management */
.zak-account-create-card {
    margin-bottom: 22px;
    padding: 22px;
}

.zak-account-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.zak-account-create-action {
    align-self: end;
}

.zak-role-key {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 22px;
}

.zak-role-key article {
    display: grid;
    gap: 5px;
    padding: 15px 17px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--panel-bg);
}

.zak-role-key span,
.zak-user-meta {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.zak-user-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.zak-user-card {
    padding: 20px;
}

.zak-user-card.is-inactive {
    opacity: 0.72;
}

.zak-user-edit-form {
    display: grid;
    gap: 13px;
}

.zak-active-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
}

.zak-password-reset {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}

.zak-password-reset summary {
    margin-bottom: 14px;
    cursor: pointer;
    color: var(--brand-dark);
    font-weight: 800;
}

.zak-unlock-form {
    margin-top: 14px;
}

.zak-user-meta {
    margin: 16px 0 0;
}

.zak-account-panel {
    max-width: 560px;
}

@media (max-width: 900px) {
    .zak-account-form-grid,
    .zak-role-key,
    .zak-user-list {
        grid-template-columns: 1fr;
    }
}

/* Sian dashboard card builder */
.sian-dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-builder-card {
    position: relative;
    min-height: 230px;
}

.dashboard-builder-card .card-header {
    padding-right: 30px;
}

.dashboard-card-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.dashboard-card-remove:hover,
.dashboard-card-remove:focus {
    background: #fdeaea;
    border-color: #f3c1c1;
    color: #8a2525;
    outline: none;
}

.dashboard-empty-slot {
    min-height: 230px;
    padding: 0;
    border: 2px dashed #cbd8c6;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: none;
}

.dashboard-add-slot-button {
    width: 100%;
    height: 100%;
    min-height: 230px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.dashboard-add-slot-button:hover,
.dashboard-add-slot-button:focus {
    color: var(--brand-dark);
    outline: none;
}

.dashboard-add-slot-button:hover .dashboard-plus-icon,
.dashboard-add-slot-button:focus .dashboard-plus-icon {
    border-color: var(--brand);
    background: #eef5e3;
}

.dashboard-plus-icon {
    width: 58px;
    height: 58px;
    border: 2px solid #cbd8c6;
    border-radius: 999px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: var(--brand-dark);
    font-size: 38px;
    line-height: 1;
}

.dashboard-sync-list {
    margin-top: 14px;
}

.dashboard-modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(31, 42, 36, 0.48);
    z-index: 1000;
}

.dashboard-modal-backdrop.is-open {
    display: flex;
}

.dashboard-modal {
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    overflow: auto;
    background: var(--panel-bg);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(31, 42, 36, 0.22);
    padding: 20px;
}

.dashboard-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.dashboard-modal-header h2 {
    margin: 0 0 6px;
    color: var(--brand-dark);
    font-size: 24px;
}

.dashboard-modal-header p {
    margin: 0;
    color: var(--text-muted);
}

.dashboard-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.dashboard-modal-close:hover,
.dashboard-modal-close:focus {
    background: #f8faf7;
    color: var(--brand-dark);
    outline: none;
}

.dashboard-modal-message {
    margin: 0 0 14px;
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
}

.dashboard-modal-message.is-success {
    background: var(--working-bg);
    color: var(--working-text);
}

.dashboard-modal-message.is-error {
    background: #fdeaea;
    color: #8a2525;
}

.dashboard-card-picker {
    display: grid;
    gap: 10px;
}

.dashboard-picker-category {
    margin: 12px 0 2px;
    color: var(--brand-dark);
    font-size: 15px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.dashboard-picker-category:first-child {
    margin-top: 0;
}

.dashboard-picker-card {
    width: 100%;
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    background: #f8faf7;
    color: inherit;
    cursor: pointer;
    padding: 13px 14px;
    text-align: left;
    font: inherit;
}

.dashboard-picker-card:hover,
.dashboard-picker-card:focus {
    border-color: #9dbb89;
    box-shadow: 0 0 0 3px rgba(120, 150, 96, 0.16);
    outline: none;
}

.dashboard-picker-card strong {
    display: block;
    margin-bottom: 4px;
    color: var(--brand-dark);
    font-size: 16px;
}

.dashboard-picker-card span,
.dashboard-picker-empty {
    display: block;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

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

@media (max-width: 680px) {
    .sian-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-modal-backdrop {
        align-items: flex-start;
        padding: 12px;
    }

    .dashboard-modal {
        max-height: calc(100vh - 24px);
        padding: 16px;
    }
}

/* Sian dashboard card builder v2 - no-modal card picker */
.dashboard-flash {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid var(--border-soft);
}

.dashboard-flash-success {
    background: var(--working-bg);
    color: var(--working-text);
}

.dashboard-flash-error {
    background: #fdeaea;
    color: #8a2525;
}

.dashboard-card-remove-form {
    margin: 0;
}

.dashboard-empty-slot {
    min-height: 245px;
    padding: 0;
    border: 1.5px dashed #b9cbb0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(238, 245, 227, 0.72));
    box-shadow: none;
    overflow: hidden;
}

.dashboard-add-details {
    width: 100%;
    min-height: 245px;
    display: flex;
    flex-direction: column;
}

.dashboard-add-slot-summary {
    min-height: 245px;
    padding: 22px;
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    text-align: center;
    cursor: pointer;
    color: var(--brand-dark);
}

.dashboard-add-slot-summary::-webkit-details-marker {
    display: none;
}

.dashboard-add-slot-summary::marker {
    content: '';
}

.dashboard-add-slot-summary:hover,
.dashboard-add-slot-summary:focus {
    background: rgba(231, 245, 228, 0.72);
    outline: none;
}

.dashboard-add-details[open] .dashboard-add-slot-summary {
    min-height: 0;
    padding: 16px 18px;
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.72);
}

.dashboard-add-details[open] .dashboard-plus-icon {
    width: 38px;
    height: 38px;
    font-size: 27px;
}

.dashboard-plus-icon {
    width: 68px;
    height: 68px;
    border: 2px solid #9dbb89;
    border-radius: 999px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    color: var(--brand-dark);
    font-size: 42px;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(31, 42, 36, 0.08);
}

.dashboard-add-slot-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dashboard-add-slot-text strong {
    font-size: 18px;
    line-height: 1.2;
}

.dashboard-add-slot-text em {
    color: var(--text-muted);
    font-size: 13px;
    font-style: normal;
    font-weight: 700;
}

.dashboard-slot-picker {
    padding: 16px 18px 18px;
    max-height: 430px;
    overflow: auto;
    background: #ffffff;
}

.dashboard-slot-picker-heading {
    margin-bottom: 10px;
}

.dashboard-slot-picker-heading h3 {
    margin: 0 0 4px;
    color: var(--brand-dark);
    font-size: 17px;
}

.dashboard-slot-picker-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}

.dashboard-picker-form {
    margin: 0 0 8px;
}

.dashboard-picker-category {
    margin: 16px 0 8px;
    color: var(--brand-dark);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-picker-category:first-of-type {
    margin-top: 0;
}

.dashboard-picker-card {
    width: 100%;
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    background: #f8faf7;
    color: inherit;
    cursor: pointer;
    padding: 12px 13px;
    text-align: left;
    font: inherit;
}

.dashboard-picker-card:hover,
.dashboard-picker-card:focus {
    background: #eef5e3;
    border-color: #9dbb89;
    box-shadow: 0 0 0 3px rgba(120, 150, 96, 0.16);
    outline: none;
}

.dashboard-picker-card strong {
    display: block;
    margin-bottom: 4px;
    color: var(--brand-dark);
    font-size: 15px;
}

.dashboard-picker-card span,
.dashboard-picker-empty {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

@media (max-width: 680px) {
    .dashboard-empty-slot,
    .dashboard-add-details,
    .dashboard-add-slot-summary {
        min-height: 190px;
    }

    .dashboard-plus-icon {
        width: 56px;
        height: 56px;
        font-size: 36px;
    }
}


/* Dashboard sync progress */
.sync-progress-panel {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: linear-gradient(145deg, #fbfcfa, #f1f5ef);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.sync-progress-panel[hidden] {
    display: none;
}

.sync-progress-visual {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.sync-progress-ring {
    --sync-progress: 0;
    width: 108px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--brand-dark) calc(var(--sync-progress) * 1%), #dfe7dc 0);
    box-shadow: 0 7px 18px rgba(39, 74, 43, .14);
    transition: background .55s ease;
    position: relative;
}

.sync-progress-ring::after {
    content: '';
    position: absolute;
    inset: 9px;
    border-radius: inherit;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(39, 74, 43, .08);
}

.sync-progress-ring-centre {
    position: relative;
    z-index: 1;
    display: grid;
    text-align: center;
}

.sync-progress-ring-centre strong {
    color: var(--brand-dark);
    font-size: 24px;
    line-height: 1;
}

.sync-progress-ring-centre span {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.sync-progress-details {
    min-width: 0;
}

.sync-progress-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.sync-step {
    position: relative;
    padding-top: 19px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sync-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    border: 3px solid #dfe7dc;
    border-radius: 50%;
    background: #fff;
    transform: translateX(-50%);
    z-index: 2;
}

.sync-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 6px;
    left: calc(50% + 8px);
    width: calc(100% - 16px);
    height: 3px;
    background: #dfe7dc;
}

.sync-step.is-active::before {
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 4px rgba(39, 74, 43, .12);
}

.sync-step.is-complete::before,
.sync-step.is-complete:not(:last-child)::after {
    border-color: var(--brand-dark);
    background: var(--brand-dark);
}

.sync-progress-stage {
    margin: 0 0 9px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.35;
}

.sync-progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe7dc;
}

.sync-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-dark), var(--brand-mid));
    transition: width .55s ease;
}

.sync-progress-time-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 11px;
}

.sync-progress-time-grid > div {
    padding: 9px 10px;
    border: 1px solid rgba(39, 74, 43, .1);
    border-radius: 10px;
    background: rgba(255,255,255,.72);
}

.sync-progress-time-grid span,
.sync-progress-time-grid strong {
    display: block;
}

.sync-progress-time-grid span {
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.sync-progress-time-grid strong {
    color: var(--brand-dark);
    font-size: 13px;
}

.sync-progress-error {
    margin-top: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    background: #fff0f0;
    color: #8a2f2f;
    font-size: 12px;
    line-height: 1.4;
}

@media (max-width: 620px) {
    .sync-progress-visual {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .sync-progress-details {
        width: 100%;
    }
}



/* Compact dashboard sync progress layout */
.dashboard-compact-grid .sync-progress-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
}

.dashboard-compact-grid .sync-progress-visual {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.dashboard-compact-grid .sync-progress-details {
    display: contents;
}

.dashboard-compact-grid .sync-progress-steps {
    order: 1;
    width: 100%;
    margin: 0 0 2px;
    gap: 2px;
}

.dashboard-compact-grid .sync-progress-ring {
    order: 2;
    width: 82px;
    align-self: center;
    box-shadow: 0 5px 14px rgba(39, 74, 43, .12);
}

.dashboard-compact-grid .sync-progress-ring::after {
    inset: 7px;
}

.dashboard-compact-grid .sync-progress-ring-centre strong {
    font-size: 21px;
}

.dashboard-compact-grid .sync-progress-ring-centre span {
    margin-top: 4px;
    font-size: 9px;
    letter-spacing: .06em;
}

.dashboard-compact-grid .sync-progress-stage {
    order: 3;
    min-height: 34px;
    margin: 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dashboard-compact-grid .sync-progress-track {
    order: 4;
    width: 100%;
    height: 9px;
}

.dashboard-compact-grid .sync-progress-time-grid {
    order: 5;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 0;
}

.dashboard-compact-grid .sync-progress-time-grid > div {
    min-width: 0;
    padding: 7px 6px;
    text-align: center;
}

.dashboard-compact-grid .sync-progress-time-grid span {
    margin-bottom: 2px;
    font-size: 8px;
    line-height: 1.2;
    letter-spacing: .02em;
}

.dashboard-compact-grid .sync-progress-time-grid strong {
    font-size: 11px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.dashboard-compact-grid .sync-step {
    padding-top: 17px;
    font-size: 8px;
    letter-spacing: .02em;
}

.dashboard-compact-grid .sync-step::before {
    width: 10px;
    height: 10px;
    border-width: 2px;
}

.dashboard-compact-grid .sync-step:not(:last-child)::after {
    top: 5px;
    left: calc(50% + 6px);
    width: calc(100% - 12px);
    height: 2px;
}
