/* ================= Buttons ================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 15px;
    border-radius: 8px;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: all 0.18s cubic-bezier(0.3, 0.7, 0.3, 1);
    user-select: none;
}

.btn .ic {
    width: 15px;
    height: 15px;
}

.btn:hover {
    color: var(--text);
    border-color: var(--line-3);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(180deg, #d8ff64, #b9e63a);
    border-color: rgba(201, 242, 77, 0.6);
    color: #111707;
    font-weight: 600;
    box-shadow: 0 8px 24px -10px rgba(201, 242, 77, 0.65), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #e2ff7d, #c4ef48);
    color: #0b1004;
    border-color: rgba(201, 242, 77, 0.8);
    box-shadow: 0 10px 30px -10px rgba(201, 242, 77, 0.8);
}

.btn-primary .ic {
    stroke-width: 2;
}

.btn-ghost {
    background: transparent;
}

.btn-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    height: 32px;
    padding: 0 9px;
}

.btn-quiet:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: transparent;
}

.btn-danger {
    background: var(--red-dim);
    border-color: rgba(255, 98, 98, 0.3);
    color: #ff9b9b;
}

.btn-danger:hover {
    background: rgba(255, 98, 98, 0.2);
    border-color: rgba(255, 98, 98, 0.45);
    color: #ffc2c2;
}

.btn-mini {
    height: 30px;
    padding: 0 10px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-mini .ic {
    width: 13px;
    height: 13px;
}

.btn-sm {
    height: 33px;
    padding: 0 12px;
    font-size: 11.5px;
}

.btn-lg {
    height: 46px;
    font-size: 14px;
    padding: 0 20px;
    border-radius: 9px;
}

.btn-block {
    width: 100%;
}

/* ================= Panels ================= */
.panel {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent 40%),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}

.panel::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.11), transparent);
    pointer-events: none;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
}

.panel-kicker {
    display: block;
    font-family: var(--font-num);
    font-size: 8.5px;
    letter-spacing: 0.2em;
    color: var(--dim);
    margin-bottom: 6px;
}

.panel-head h2 {
    font-size: 15px;
    font-weight: 500;
    color: #eef4f7;
    letter-spacing: 0.01em;
}

.panel-note {
    font-size: 10.5px;
    color: var(--dim);
    font-family: var(--font-num);
    white-space: nowrap;
    padding-top: 4px;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
    padding-top: 3px;
    white-space: nowrap;
    transition: color 0.16s;
}

.panel-link:hover {
    color: var(--lime);
}

.panel-link .ic {
    width: 13px;
    height: 13px;
}

.side-panel {
    padding-bottom: 6px;
}

/* ================= Stat strip ================= */
.stat-strip,
.approval-stat-strip,
.org-stats,
.flow-stats,
.dict-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 18px;
}

.stat-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent), var(--panel);
}

.stat-cell span {
    font-size: 11px;
    color: var(--muted);
}

.stat-cell strong {
    font-family: var(--font-num);
    font-size: 27px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #f2f7f9;
    line-height: 1.1;
}

.stat-cell .tone {
    position: absolute;
    right: 18px;
    top: 20px;
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--dim);
}

.tone.lime { background: var(--lime); box-shadow: 0 0 12px rgba(201, 242, 77, 0.6); }
.tone.cyan { background: var(--cyan); box-shadow: 0 0 12px rgba(82, 217, 199, 0.55); }
.tone.amber { background: var(--amber); box-shadow: 0 0 12px rgba(242, 181, 68, 0.5); }
.tone.red { background: var(--red); box-shadow: 0 0 12px rgba(255, 98, 98, 0.55); }
.tone.slate { background: var(--dim); }

/* ================= KPI ================= */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 13px;
    margin-bottom: 16px;
}

.kpi-card {
    position: relative;
    min-height: 132px;
    padding: 17px 18px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(160px 90px at 100% 0%, rgba(82, 217, 199, 0.06), transparent 70%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 55%),
        var(--panel);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}

.kpi-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--lime), transparent);
    opacity: 0.5;
}

.kpi-card[data-tone="cyan"]::before { background: linear-gradient(180deg, transparent, var(--cyan), transparent); }
.kpi-card[data-tone="amber"]::before { background: linear-gradient(180deg, transparent, var(--amber), transparent); }
.kpi-card[data-tone="red"]::before { background: linear-gradient(180deg, transparent, var(--red), transparent); }

.kpi-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--muted);
}

.kpi-label .ic {
    width: 15px;
    height: 15px;
    color: var(--dim);
}

.kpi-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 11px;
    line-height: 1;
}

.kpi-value strong {
    font-family: var(--font-num);
    font-size: 33px;
    font-weight: 500;
    letter-spacing: -0.035em;
    color: #f5f9fb;
}

.kpi-value em {
    font-style: normal;
    font-size: 11px;
    color: var(--dim);
}

.kpi-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    font-size: 10.5px;
    color: var(--muted);
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-num);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--lime-dim);
    color: var(--lime);
}

.kpi-delta.down {
    background: var(--red-dim);
    color: #ff9b9b;
}

.kpi-delta.flat {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
}

.kpi-spark {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 92px;
    height: 34px;
    opacity: 0.7;
}

/* ================= Toolbar / filters ================= */
.list-toolbar,
.feed-toolbar,
.snapshot-toolbar,
.org-table-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    min-width: 250px;
    max-width: 340px;
    flex: 1;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    transition: all 0.18s;
}

.search-box:focus-within {
    border-color: rgba(201, 242, 77, 0.5);
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 0 0 0 3px rgba(201, 242, 77, 0.06);
}

.search-box .ic {
    width: 15px;
    height: 15px;
    color: var(--dim);
    flex: none;
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 12.5px;
    color: var(--text);
    height: 100%;
}

.search-box.compact {
    min-width: 190px;
    max-width: 240px;
    height: 34px;
}

.search-clear {
    display: none;
    color: var(--dim);
}

.search-clear .ic {
    width: 13px;
    height: 13px;
}

.search-box.has-value .search-clear {
    display: block;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-select {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
}

.filter-select > span {
    color: var(--dim);
}

.filter-select select {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 11.5px;
    padding: 0 18px 0 0;
    outline: none;
    cursor: pointer;
    max-width: 150px;
}

.filter-select > .ic {
    position: absolute;
    right: 7px;
    width: 13px;
    height: 13px;
    color: var(--dim);
    pointer-events: none;
}

.filter-select.compact {
    height: 34px;
    padding: 0 8px;
}

.filter-select.compact select {
    max-width: 120px;
}

.filter-select.wide {
    min-width: 220px;
}

.date-field {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 9px 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
    font-size: 11px;
    color: var(--dim);
}

.date-field input {
    border: 0;
    background: transparent;
    outline: none;
    color: var(--text-2);
    font-family: var(--font-num);
    font-size: 10.5px;
    cursor: pointer;
    min-width: 105px;
}

.date-field input::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
}

.toolbar-meta {
    margin-left: auto;
    font-family: var(--font-num);
    font-size: 10px;
    color: var(--dim);
    white-space: nowrap;
}

/* ================= Chip tabs / segments ================= */
.chip-tabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.18);
}

.chip-tabs button {
    height: 28px;
    padding: 0 11px;
    border-radius: 6px;
    font-size: 11.5px;
    color: var(--muted);
    transition: all 0.18s;
    white-space: nowrap;
}

.chip-tabs button:hover {
    color: var(--text);
}

.chip-tabs button.is-on {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f6f8;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.seg-control {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    gap: 2px;
    background: rgba(0, 0, 0, 0.16);
}

.seg-control button {
    height: 26px;
    padding: 0 10px;
    border-radius: 5px;
    font-size: 10.5px;
    color: var(--muted);
}

.seg-control button.is-on {
    background: var(--line-2);
    color: var(--text);
}

/* ================= Table ================= */
.data-area {
    position: relative;
    min-height: 120px;
}

.is-loading {
    opacity: 0.85;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 14px;
    text-align: left;
    font-family: var(--font-num);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--dim);
    background: #0d1316;
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    color: var(--text-2);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(201, 242, 77, 0.05), rgba(255, 255, 255, 0.014) 50%, transparent);
}

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

.data-table .cell-link {
    color: #e8f7c0;
    font-family: var(--font-num);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    border-bottom: 1px dashed rgba(201, 242, 77, 0.28);
    transition: border-color 0.16s, color 0.16s;
}

.data-table .cell-link:hover {
    color: var(--lime);
    border-color: var(--lime);
}

.data-table .cell-mono {
    font-family: var(--font-num);
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

.data-table .cell-strong {
    color: #eaf0f3;
    font-weight: 500;
}

.data-table .cell-num {
    font-family: var(--font-num);
    font-size: 11px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table .cell-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.row-btn {
    width: 28px;
    height: 26px;
    display: inline-grid;
    place-items: center;
    border-radius: 5px;
    border: 1px solid transparent;
    color: var(--dim);
    transition: all 0.16s;
}

.row-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--line);
}

.row-btn.danger:hover {
    color: #ff9b9b;
    background: var(--red-dim);
    border-color: rgba(255, 98, 98, 0.25);
}

.row-btn .ic {
    width: 14px;
    height: 14px;
}

.cell-sub {
    display: block;
    margin-top: 3px;
    font-size: 9.5px;
    color: var(--dim);
}

/* ================= Status / tags ================= */
.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.status.s-success {
    color: #d6f878;
    background: rgba(201, 242, 77, 0.09);
    border-color: rgba(201, 242, 77, 0.2);
}

.status.s-warning {
    color: #ffd07e;
    background: rgba(242, 181, 68, 0.1);
    border-color: rgba(242, 181, 68, 0.22);
}

.status.s-danger {
    color: #ff9c9c;
    background: rgba(255, 98, 98, 0.1);
    border-color: rgba(255, 98, 98, 0.24);
}

.status.s-info {
    color: #8ee9dd;
    background: rgba(82, 217, 199, 0.09);
    border-color: rgba(82, 217, 199, 0.2);
}

.status.s-blue {
    color: #a9caff;
    background: rgba(106, 167, 255, 0.1);
    border-color: rgba(106, 167, 255, 0.22);
}

.status.s-violet {
    color: #c9b8ff;
    background: rgba(176, 152, 250, 0.1);
    border-color: rgba(176, 152, 250, 0.22);
}

.status.s-neutral {
    color: #a6b4bd;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line-2);
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--font-num);
    font-size: 9.5px;
    color: var(--text-2);
    white-space: nowrap;
}

.tag.lime { color: var(--lime); border-color: rgba(201, 242, 77, 0.25); background: var(--lime-dim); }
.tag.cyan { color: var(--cyan); border-color: rgba(82, 217, 199, 0.25); background: var(--cyan-dim); }

/* ================= Percent bar ================= */
.bar-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.bar-track {
    flex: 1;
    height: 3px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    min-width: 42px;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(201, 242, 77, 0.6), var(--lime));
}

.bar-fill.warn {
    background: linear-gradient(90deg, rgba(242, 181, 68, 0.6), var(--amber));
}

.bar-fill.danger {
    background: linear-gradient(90deg, rgba(255, 98, 98, 0.6), var(--red));
}

.bar-cell b {
    font-family: var(--font-num);
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-2);
    min-width: 38px;
    text-align: right;
}

/* ================= List footer / pager ================= */
.list-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
}

.list-summary {
    font-size: 10.5px;
    color: var(--dim);
    font-family: var(--font-num);
    letter-spacing: 0.02em;
}

.pager {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pager button {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 5px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-num);
    font-size: 10px;
    transition: all 0.16s;
}

.pager button:hover:not(:disabled) {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.pager button.is-on {
    background: var(--lime);
    border-color: var(--lime);
    color: #111707;
    font-weight: 600;
}

.pager button:disabled {
    opacity: 0.3;
}

.pager .pager-ellipsis {
    color: var(--dim);
    padding: 0 4px;
    font-family: var(--font-num);
    font-size: 10px;
}

/* ================= Entity cards ================= */
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 13px;
    padding: 16px 18px;
}

.entity-card {
    position: relative;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 45%),
        var(--panel-2);
    transition: all 0.2s cubic-bezier(0.3, 0.7, 0.3, 1);
    cursor: pointer;
    overflow: hidden;
}

.entity-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20px;
    width: 2px;
    height: 30px;
    border-radius: 2px;
    background: var(--lime);
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 0 12px rgba(201, 242, 77, 0.6);
}

.entity-card:hover {
    border-color: rgba(201, 242, 77, 0.28);
    transform: translateY(-2px);
    box-shadow: 0 22px 40px -26px rgba(0, 0, 0, 0.95);
}

.entity-card:hover::before {
    opacity: 1;
}

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

.entity-eyebrow {
    font-family: var(--font-num);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--dim);
    text-transform: uppercase;
}

.entity-title {
    font-size: 16px;
    font-weight: 500;
    color: #f0f5f7;
    line-height: 1.35;
    word-break: break-all;
}

.entity-sub {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}

.entity-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin: 14px 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
    background: var(--line);
}

.entity-metric {
    background: rgba(0, 0, 0, 0.18);
    padding: 8px 10px;
    min-width: 0;
}

.entity-metric span {
    display: block;
    font-size: 9.5px;
    color: var(--dim);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-metric b {
    font-family: var(--font-num);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: -0.02em;
}

.entity-metric b em {
    font-style: normal;
    font-size: 8.5px;
    color: var(--dim);
    margin-left: 2px;
}

.entity-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 10px;
    color: var(--dim);
}

.entity-foot span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-progress {
    margin: 10px 0 12px;
}

.entity-progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 9.5px;
    color: var(--dim);
    margin-bottom: 5px;
}

.entity-progress-head b {
    font-family: var(--font-num);
    font-weight: 500;
    color: var(--text-2);
}

/* ================= Empty / skeleton ================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    text-align: center;
    color: var(--dim);
}

.empty-state .ic {
    width: 30px;
    height: 30px;
    color: var(--dim);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 14px;
    color: var(--text-2);
    font-weight: 500;
}

.empty-state p {
    font-size: 11.5px;
    color: var(--dim);
}

.empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 54px 20px;
    color: var(--dim);
    font-size: 12px;
}

.empty-hint .ic {
    width: 30px;
    height: 30px;
    opacity: 0.5;
}

.skeleton-table {
    padding: 8px 18px;
}

.skeleton-row {
    display: flex;
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.skeleton-row span {
    height: 9px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    flex: 1;
}

.skeleton-row span:nth-child(2) { flex: 0.7; }
.skeleton-row span:nth-child(3) { flex: 0.5; }
.skeleton-row span:nth-child(4) { flex: 0.35; }

.skeleton-card {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    pointer-events: none;
}

.sk {
    display: block;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

.sk-sm { width: 30%; }
.sk-md { width: 65%; }
.sk-lg { width: 55%; height: 24px; }
.sk-xs { width: 40%; }

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-line {
    height: 44px;
    margin: 12px 18px;
    border-radius: 7px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

/* ================= Modal ================= */
.modal-root {
    position: relative;
    z-index: 200;
}

.modal-layer {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(4, 7, 9, 0.72);
    backdrop-filter: blur(8px) saturate(120%);
    animation: backdropIn 0.2s ease;
}

.modal-layer.is-nested {
    z-index: 240;
    background: rgba(4, 7, 9, 0.62);
}

@keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    position: relative;
    width: min(680px, 100%);
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(600px 200px at 20% 0%, rgba(82, 217, 199, 0.045), transparent 65%),
        linear-gradient(180deg, #141c21 0%, #0f1519 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 30px 60px -20px rgba(0, 0, 0, 0.9),
        0 80px 120px -40px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    animation: modalIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

.modal::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(201, 242, 77, 0.7), rgba(82, 217, 199, 0.45), transparent);
    z-index: 2;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-layer.is-closing .modal {
    animation: modalOut 0.16s ease forwards;
}

@keyframes modalOut {
    to { opacity: 0; transform: translateY(8px) scale(0.99); }
}

.modal.modal-sm { width: min(460px, 100%); }
.modal.modal-lg { width: min(860px, 100%); }
.modal.modal-xl { width: min(1080px, 100%); }
.modal.modal-full { width: min(1280px, 100%); }

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--line);
    flex: none;
}

.modal-head .kicker {
    display: block;
    font-family: var(--font-num);
    font-size: 8.5px;
    letter-spacing: 0.2em;
    color: var(--dim);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.modal-head h3 {
    font-size: 19px;
    font-weight: 500;
    color: #f3f8fa;
    letter-spacing: 0.01em;
}

.modal-head p {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--muted);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.02);
    flex: none;
    transition: all 0.16s;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--line-2);
}

.modal-close .ic {
    width: 15px;
    height: 15px;
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body.no-pad {
    padding: 0;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.16);
    flex: none;
}

.modal-foot .foot-left {
    margin-right: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, rgba(201, 242, 77, 0.04), transparent 55%);
}

.modal-hero .hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(201, 242, 77, 0.08);
    border: 1px solid rgba(201, 242, 77, 0.22);
    color: var(--lime);
    flex: none;
}

.modal-hero .hero-icon .ic {
    width: 22px;
    height: 22px;
}

.modal-hero h3 {
    font-size: 20px;
    font-weight: 500;
}

.modal-hero p {
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--muted);
}

.modal-hero .hero-meta {
    margin-left: auto;
    text-align: right;
    font-family: var(--font-num);
    font-size: 10px;
    color: var(--dim);
    line-height: 1.8;
}

/* Detail tabs */
.detail-tabs {
    display: flex;
    gap: 2px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.1);
}

.detail-tabs button {
    position: relative;
    height: 42px;
    padding: 0 13px;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.18s;
}

.detail-tabs button:hover {
    color: var(--text-2);
}

.detail-tabs button.is-on {
    color: var(--lime);
}

.detail-tabs button.is-on::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    background: var(--lime);
    box-shadow: 0 0 10px rgba(201, 242, 77, 0.5);
}

.detail-section {
    padding: 18px 22px;
}

.detail-section + .detail-section {
    border-top: 1px solid var(--line);
}

.detail-section h4 {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.detail-section h4 .ic {
    width: 14px;
    height: 14px;
    color: var(--lime);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.detail-item {
    background: var(--panel);
    padding: 11px 13px;
    min-width: 0;
}

.detail-item.full {
    grid-column: span 3;
}

.detail-item span {
    display: block;
    font-size: 9.5px;
    color: var(--dim);
    margin-bottom: 4px;
}

.detail-item b {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.detail-item b.mono {
    font-family: var(--font-num);
    font-size: 11px;
}

.detail-item b.pre {
    white-space: pre-wrap;
    font-weight: 400;
    color: var(--text-2);
    line-height: 1.65;
    font-size: 11.5px;
}

.detail-empty {
    padding: 30px;
    text-align: center;
    color: var(--dim);
    font-size: 11.5px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.param-chip {
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 9px 11px;
    background: rgba(0, 0, 0, 0.16);
}

.param-chip span {
    display: block;
    font-size: 9.5px;
    color: var(--dim);
    margin-bottom: 3px;
}

.param-chip b {
    font-family: var(--font-num);
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
}

/* ================= Forms ================= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-field > label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
}

.form-field > label i {
    font-style: normal;
    color: var(--red);
}

.form-control {
    position: relative;
    display: flex;
    align-items: center;
}

.form-control > .ic {
    position: absolute;
    left: 11px;
    width: 14px;
    height: 14px;
    color: var(--dim);
    pointer-events: none;
}

.form-control input,
.form-control select,
.form-field > textarea,
.form-field > input {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.form-control.has-icon input,
.form-control.has-icon select {
    padding-left: 33px;
}

.form-field > textarea {
    height: auto;
    min-height: 82px;
    padding: 10px 11px;
    resize: vertical;
    line-height: 1.6;
}

.form-control input:focus,
.form-control select:focus,
.form-field > textarea:focus,
.form-field > input:focus {
    border-color: rgba(201, 242, 77, 0.5);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(201, 242, 77, 0.06);
}

.form-control select {
    appearance: none;
    cursor: pointer;
    padding-right: 30px;
}

.form-control .select-chev {
    position: absolute;
    right: 10px;
    width: 13px;
    height: 13px;
    color: var(--dim);
    pointer-events: none;
}

.form-hint {
    font-size: 9.5px;
    color: var(--dim);
    line-height: 1.5;
}

.form-errors {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 98, 98, 0.3);
    border-radius: 7px;
    background: var(--red-dim);
    color: #ffb3b3;
    font-size: 11.5px;
}

.form-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--line);
    margin: 4px 0;
}

.form-section-title {
    grid-column: 1 / -1;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--dim);
    font-family: var(--font-num);
    text-transform: uppercase;
    padding-top: 2px;
}

/* Confirm modal */
.confirm-body {
    padding: 24px 24px 8px;
    text-align: center;
}

.confirm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--amber-dim);
    border: 1px solid rgba(242, 181, 68, 0.3);
    color: var(--amber);
}

.confirm-icon.danger {
    background: var(--red-dim);
    border-color: rgba(255, 98, 98, 0.3);
    color: var(--red);
}

.confirm-icon .ic {
    width: 23px;
    height: 23px;
}

.confirm-body h3 {
    font-size: 17px;
    font-weight: 500;
}

.confirm-body p {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    white-space: pre-line;
}

.confirm-input {
    margin-top: 16px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.22);
    outline: none;
    font-size: 12.5px;
}

.confirm-textarea {
    margin-top: 16px;
    width: 100%;
    min-height: 82px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.22);
    outline: none;
    font-size: 12.5px;
    resize: vertical;
    font-family: inherit;
}

/* ================= Toast ================= */
.toast-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 9px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 12px 14px;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: linear-gradient(180deg, #182126, #12181c);
    box-shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.9);
    animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: auto;
}

.toast .ic {
    width: 17px;
    height: 17px;
    margin-top: 1px;
    flex: none;
}

.toast.success { border-color: rgba(201, 242, 77, 0.3); }
.toast.success .ic { color: var(--lime); }
.toast.error { border-color: rgba(255, 98, 98, 0.35); }
.toast.error .ic { color: var(--red); }
.toast.info .ic { color: var(--cyan); }
.toast.warn .ic { color: var(--amber); }

.toast div {
    flex: 1;
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.55;
    word-break: break-word;
}

.toast strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 2px;
}

.toast.is-out {
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(18px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(12px); }
}

/* ================= Command palette ================= */
.command {
    padding: 8px;
}

.command-input {
    display: flex;
    align-items: center;
    gap: 11px;
    height: 58px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
}

.command-input > .ic {
    width: 19px;
    height: 19px;
    color: var(--lime);
}

.command-input input {
    flex: 1;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: var(--text);
}

.command-input kbd {
    font-family: var(--font-num);
    font-size: 9px;
    color: var(--dim);
    border: 1px solid var(--line-2);
    border-radius: 4px;
    padding: 3px 6px;
}

.command-hint {
    padding: 9px 14px 7px;
    font-family: var(--font-num);
    font-size: 8.5px;
    letter-spacing: 0.08em;
    color: var(--dim);
}

.command-list {
    max-height: 430px;
    overflow-y: auto;
    padding: 2px 4px 6px;
}

.command-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 7px;
    text-align: left;
    transition: background 0.14s;
}

.command-item:hover,
.command-item.is-on {
    background: rgba(201, 242, 77, 0.06);
}

.command-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
    color: var(--lime);
    flex: none;
}

.command-icon .ic {
    width: 16px;
    height: 16px;
}

.command-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.command-text strong {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
}

.command-text em {
    font-style: normal;
    font-size: 9.5px;
    color: var(--dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-item > .ic {
    width: 13px;
    height: 13px;
    color: var(--dim);
    opacity: 0;
}

.command-item:hover > .ic,
.command-item.is-on > .ic {
    opacity: 1;
    color: var(--lime);
}

.command-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 44px 20px;
    color: var(--dim);
    font-size: 11.5px;
}

.command-empty .ic {
    width: 26px;
    height: 26px;
    opacity: 0.5;
}

/* Card quick ops */
.entity-card .card-ops {
    position: absolute;
    top: 9px;
    right: 9px;
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 6px;
    background: rgba(10, 15, 18, 0.88);
    border: 1px solid var(--line);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: all 0.16s;
    z-index: 3;
}

.entity-card:hover .card-ops {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.page-root.is-navigating {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 0.16s;
}

/* ================= Mini utilities ================= */
.inline-flex { display: inline-flex; align-items: center; gap: 6px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.text-lime { color: var(--lime); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--cyan); }
.nowrap { white-space: nowrap; }
.w-full { width: 100%; }

@media (max-width: 960px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-strip, .approval-stat-strip, .org-stats, .flow-stats, .dict-stats { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-item.full { grid-column: span 2; }
    .modal-layer { padding: 14px; }
    .modal { max-height: calc(100vh - 28px); }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .stat-strip, .approval-stat-strip, .org-stats, .flow-stats, .dict-stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item.full { grid-column: span 1; }
    .params-grid { grid-template-columns: 1fr 1fr; }
    .search-box { max-width: none; min-width: 100%; }
    .entity-grid { grid-template-columns: 1fr; padding: 13px; }
    .modal-head, .modal-body, .detail-section { padding-left: 16px; padding-right: 16px; }
    .modal-foot { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
    .toolbar-meta { display: none; }
}
