:host {
    display: block;
    width: 100%;
    min-width: 0;
}

.datasets-page {
    display: flex;
    height: 100%;
    flex-direction: column;
    min-height: 0;
    background: #f7f7f9;
    color: #111827;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 30px 18px;
    border-bottom: 1px solid #dedee3;
    background: #fff;
}

.dataset-action-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 30px 0;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

h2,
h3,
p {
    margin: 0;
}

h2 {
    font-size: 20px;
}

h3 {
    font-size: 17px;
}

.page-header>p {
    margin-top: 12px;
    color: #64748b;
    font-size: 16px;
}

.setup-badge {
    border-radius: 999px;
    padding: 4px 11px;
    background: #f0e8ff;
    color: #6230b4;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
}

.new-dataset-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid #dedee5;
    border-radius: 8px;
    padding: 0 15px;
    font: inherit;
    cursor: pointer;
}

.new-dataset-button {
    margin-left: auto;
    flex: 0 0 auto;
    border-color: #7c3dd3;
    background: #7c3dd3;
    color: #fff;
    box-shadow: 0 2px 4px rgba(74, 28, 143, .24);
}

.new-dataset-button .mat-icon,
.back-button .mat-icon {
    width: 19px;
    height: 19px;
    font-size: 19px;
}

.back-button {
    background: #fff;
    color: #374151;
}

.dataset-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
    width: 100%;
    height: calc(100dvh - 250px);
    min-height: 0;
    box-sizing: border-box;
    gap: 22px;
    padding: 24px 30px 32px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dataset-list-card,
.dataset-overview {
    min-width: 0;
    align-self: start;
    overflow: hidden;
    border: 1px solid #e1e1e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .10);
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e8;
    font-size: 16px;
}

.list-header span {
    color: #64748b;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px;
}

.search-box>.mat-icon {
    flex: 0 0 auto;
    color: #64748b;
}

.search-box gb-input {
    min-width: 0;
    flex: 1;
}

.dataset-list {
    padding: 0 10px 10px;
}

.dataset-list-item {
    display: flex;
    width: 100%;
    gap: 12px;
    border: 0;
    border-radius: 7px;
    padding: 12px 10px;
    background: transparent;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.dataset-list-item:hover {
    background: #f4edff;
}

.dataset-list-item>.mat-icon {
    color: #6b36bc;
}

.dataset-list-item>span {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.dataset-list-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

.dataset-list-item small {
    color: #64748b;
    font-family: monospace;
    font-size: 13px;
}

.empty-list {
    padding: 28px 18px;
    color: #64748b;
    text-align: center;
}

.dataset-editor {
    min-width: 0;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    margin-bottom: 14px;
}

.editor-toolbar gb-formaction {
    min-width: 0;
    flex: 1;
}

.dataset-form-layout {
    display: grid;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 22px;
}

.dataset-overview {
    display: grid;
    min-height: 320px;
    place-content: center;
    justify-items: center;
    gap: 10px;
    padding: 30px;
    color: #64748b;
    text-align: center;
}

.dataset-overview>.mat-icon {
    width: 48px;
    height: 48px;
    color: #a78bfa;
    font-size: 48px;
}

.dataset-overview h3 {
    color: #374151;
}

.dataset-overview p {
    max-width: 420px;
    font-size: 14px;
}

.form-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #e1e1e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .10);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 22px;
    border-bottom: 1px solid #e5e5e8;
    background: #fbfbfd;
}

.card-header p {
    margin-top: 5px;
    color: #64748b;
    font-size: 13px;
}

.card-header>.mat-icon {
    width: 28px;
    height: 28px;
    color: #7c3dd3;
    font-size: 28px;
}

.order-note {
    border-radius: 999px;
    padding: 6px 11px;
    background: #f0e8ff;
    color: #6230b4;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    gap: 20px 28px;
    padding: 22px;
}

.dataset-field {
    display: block;
    width: 100%;
    min-width: 0;
}

.remarks-field {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

.form-grid-host {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.form-grid-host gb-formgrid {
    display: block;
    min-width: 0;
}

.table-help {
    padding: 14px 22px;
    border-top: 1px solid #e5e5e8;
    color: #64748b;
    font-size: 13px;
}

::ng-deep .dataset-field .Mat_Form_Field,
::ng-deep .remarks-field .Mat_Form_Field {
    width: 100% !important;
}

::ng-deep .dataset-field .mat-mdc-text-field-wrapper,
::ng-deep .remarks-field .mat-mdc-text-field-wrapper {
    width: 100%;
}

::ng-deep .form-grid-host .Grid-sticky-header {
    width: 100% !important;
    max-width: 100% !important;
}

::ng-deep .search-box .formlabel {
    display: none;
}

::ng-deep .search-box .Mat_Form_Field {
    width: 100% !important;
    height: 38px !important;
}

::ng-deep .search-box .mat-mdc-text-field-wrapper {
    min-height: 38px !important;
}

::ng-deep .search-box .mat-mdc-form-field-subscript-wrapper {
    display: none;
}

@media (max-width: 700px) {
    .page-header {
        align-items: stretch;
        flex-direction: column;
        padding: 16px;
    }

    .dataset-action-row {
        padding: 12px 16px 0;
    }

    .page-header>p {
        font-size: 14px;
    }

    .dataset-workspace {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: calc(100dvh - 220px);
        gap: 16px;
        padding: 16px;
    }

    .editor-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .field-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 16px;
    }

    .remarks-field {
        grid-column: auto;
    }

    .card-header {
        align-items: flex-start;
        padding: 15px 16px;
    }

    .order-note {
        white-space: normal;
        text-align: right;
    }
}
