/* ==========================================================
   TABLE SECTION HEADER
   ========================================================== */

.table-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 14px;
}

.table-title {

    font-size: 20px;

    font-weight: 600;

    color: #1d1d1f;
}

.table-subtitle {

    margin-top: 2px;

    font-size: 13px;

    color: #8e8e93;
}



/* ==========================================================
   TABLE
   ========================================================== */

.table {

    width: 100%;

    border-collapse: collapse;

    background: #ffffff;

    font-size: 14px;

    color: #1d1d1f;
}

.table-surface {
    width: 100%;
    max-width: 720px;
    overflow: hidden;
    border: 1px solid #d1d1d6;
    border-radius: 10px;
    background: #ffffff;
}

.table-surface .table {
    margin: 0;
}



/* ==========================================================
   HEADER
   ========================================================== */

.table thead {

    background: #f5f5f7;
}

.table th {

    padding: 10px 12px;

    text-align: left;

    font-weight: 600;

    color: #1d1d1f;

    border-bottom: 1px solid #d1d1d6;

    white-space: nowrap;
}

.table-filter-row th {
    padding: 6px 8px;
    background: #fbfbfd;
    border-bottom: 1px solid #d1d1d6;
}

.table-filter-control {
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    background: #ffffff;
    color: #1d1d1f;
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    outline: none;
    box-sizing: border-box;
}

.table-filter-control:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.14);
}

.table-filter-select {
    cursor: pointer;
}

.table-filter-empty {
    display: block;
    height: 30px;
}



/* ==========================================================
   CELLS
   ========================================================== */

.table td {

    padding: 10px 12px;

    border-bottom: 1px solid #ececec;

    vertical-align: middle;

    color: #1d1d1f;
}

.table th:first-child,
.table td:first-child {
    padding-left: 14px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 14px;
}



/* ==========================================================
   ROW HOVER
   ========================================================== */

.table tbody tr:hover {

    background: #f9f9fb;
}



/* ==========================================================
   SELECTED ROW
   ========================================================== */

.table tbody tr.selected {

    background: #e8f2ff;
}



/* ==========================================================
   ZEBRA ROWS
   ========================================================== */

.table tbody tr:nth-child(even) {

    background: #fcfcfd;
}



/* ==========================================================
   LAST ROW
   ========================================================== */

.table tbody tr:last-child td {

    border-bottom: none;
}



/* ==========================================================
   ALIGNMENT
   ========================================================== */

.align-left {

    text-align: left;
}

.align-center {

    text-align: center;
}

.align-right {

    text-align: right;
}



/* ==========================================================
   COLUMN WIDTHS
   ========================================================== */

.col-small {

    width: 80px;
}

.col-medium {

    width: 140px;
}

.col-large {

    width: 220px;
}



/* ==========================================================
   TEXT HELPERS
   ========================================================== */

.nowrap {

    white-space: nowrap;
}

.wrap {

    white-space: normal;
}



/* ==========================================================
   ROW STATES
   ========================================================== */

.row-clickable {

    cursor: pointer;
}

.row-disabled {

    opacity: .55;
}

.table-action {
    color: #007AFF;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.table-action:hover {
    text-decoration: underline;
}

.table-action-button {
    min-height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.table-action-delete {
    background: #d92d20;
    color: #ffffff;
}

.table-action-delete:hover {
    background: #b42318;
}



/* ==========================================================
   EDITABLE TABLES
   ========================================================== */

.table-surface-editable {
    max-width: none;
    overflow-x: auto;
}

.table-editable {
    min-width: 980px;
    table-layout: fixed;
    font-size: 13px;
}

.table-editable thead {
    background: #f6f7f9;
}

.table-editable th {
    width: var(--col-width, auto);
    height: 34px;
    padding: 7px 8px;
    font-size: 12px;
    color: #5f6673;
}

.table-editable td {
    width: var(--col-width, auto);
    height: 38px;
    padding: 4px 6px;
    position: relative;
}

.table-editable tbody tr:hover {
    background: #f7fbff;
}

.table-editable tbody tr:focus-within {
    background: #eef6ff;
}

.table-input,
.table-select {
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #1d1d1f;
    font: inherit;
    outline: none;
    box-sizing: border-box;
}

.table-input:hover,
.table-select:hover {
    background: #ffffff;
    border-color: #d1d1d6;
}

.table-input:focus,
.table-select:focus {
    background: #ffffff;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.16);
}

.table-input[type="number"] {
    appearance: textfield;
    text-align: right;
}

.table-input[type="number"]::-webkit-inner-spin-button,
.table-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.table-select {
    cursor: pointer;
}

.table-select-hidden {
    display: none;
}

.table-combobox {
    position: relative;
    width: 100%;
}

.form-combobox .table-combobox-trigger {
    height: 34px;
    padding: 0 12px;
    border-color: #d1d1d6;
    border-radius: 8px;
    background: #ffffff;
}

.form-combobox .table-combobox-trigger:hover {
    background: #ffffff;
    border-color: #b8b8c0;
}

.form-combobox .table-combobox-trigger:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.table-combobox-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #1d1d1f;
    font: inherit;
    text-align: left;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
}

.table-combobox-trigger:hover {
    background: #ffffff;
    border-color: #d1d1d6;
}

.table-combobox-trigger:focus {
    background: #ffffff;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.16);
}

.table-combobox-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-combobox.is-empty .table-combobox-value {
    color: #8e8e93;
}

.table-combobox-arrow {
    width: 8px;
    height: 8px;
    margin-right: 2px;
    border-right: 2px solid #4b5563;
    border-bottom: 2px solid #4b5563;
    transform: translateY(-2px) rotate(45deg);
    flex: 0 0 auto;
}

.table-combobox-popup {
    display: none;
    position: fixed;
    z-index: 1000;
    max-height: 230px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid rgba(60, 60, 67, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(18px);
}

.table-combobox.is-open .table-combobox-popup {
    display: block;
}

.table-combobox-filter {
    width: 100%;
    height: 32px;
    margin: 0 0 4px 0;
    padding: 0 9px;
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: #1d1d1f;
    font: inherit;
    outline: none;
    box-sizing: border-box;
}

.table-combobox-filter:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.14);
}

.table-combobox-option {
    display: block;
    width: 100%;
    min-height: 28px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #1d1d1f;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.table-combobox-option:nth-child(n + 2) {
    margin-top: 1px;
}

.table-combobox-option:hover,
.table-combobox-option.is-active {
    background: #007aff;
    color: #ffffff;
}

.table-combobox-option.is-selected:not(.is-active) {
    background: #eef6ff;
    color: #1d1d1f;
}

.table-combobox-empty {
    padding: 7px 8px;
    color: #86868b;
    font-size: 12px;
}



/* ==========================================================
   EMPTY TABLE
   ========================================================== */

.table-empty {

    padding: 40px;

    text-align: center;

    font-size: 14px;

    color: #8e8e93;
}



/* ==========================================================
   RESPONSIVE
   ========================================================== */

.table-responsive {

    width: 100%;

    overflow-x: auto;
}
