@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700;800&display=swap');

:root {
    --gold: #FFBF3B;
    --gold-deep: #e9a827;
    --blue: #121047;
    --blue-2: #242088;
    --ink: #0e0c33;
    --paper: #f4f5fa;
    --card: #ffffff;
    --line: #e7e9f2;
    --muted: #6b6f8a;
    --font: "Lexend", Helvetica, Arial, sans-serif;
    --shadow: 0 10px 30px -12px rgba(18, 16, 71, .28);
}

* { box-sizing: border-box; }
body.compList {
    margin: 0;
    font-family: var(--font);
    background: var(--paper);
    color: var(--ink);
}
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 22px 70px; }

/* Header */
.head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.head .brand { display: flex; align-items: center; gap: 14px; }
.head .badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(140deg, var(--blue), var(--blue-2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: 800;
    box-shadow: var(--shadow);
}
.head h1 { font-size: 26px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.head .count { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Toolbar */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.search { position: relative; flex: 1; min-width: 220px; }
.search .material-symbols-outlined {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 20px;
}
.search input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-family: var(--font);
    font-size: 14.5px;
    background: var(--card);
}
.search input:focus {
    outline: none;
    border-color: var(--gold-deep);
    box-shadow: 0 0 0 3px rgba(255, 191, 59, .2);
}
.sortnote { color: var(--muted); font-size: 13px; }

/* Table card */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; }
thead th {
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: left;
    padding: 15px 18px;
    position: sticky;
    top: 0;
}
thead th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
thead th.sortable:hover { color: var(--gold); }
thead th .arrow { font-size: 18px; vertical-align: -4px; opacity: .5; }
thead th.active .arrow { opacity: 1; color: var(--gold); }
thead th.actions { text-align: right; }

tbody td {
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    font-size: 15px;
    vertical-align: middle;
}
tbody tr:hover { background: #faf9ff; }
td.name { font-weight: 600; }
td.id { color: var(--muted); }
.id-chip {
    background: #eef0f7;
    color: var(--blue);
    border-radius: 7px;
    padding: 2px 9px;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Icon actions */
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.act {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    background: #f1f2f8;
    border: 1px solid transparent;
    text-decoration: none;
    transition: .15s;
    position: relative;
}
.act .material-symbols-outlined { font-size: 21px; }
.act:hover { background: var(--gold); color: var(--blue); transform: translateY(-1px); }
.act.danger { color: #b23; }
.act.danger:hover { background: #e5484d; color: #fff; }
.act::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--blue);
    color: #fff;
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: .15s;
}
.act:hover::after { opacity: 1; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

/* Pagination */
.pager {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
}
.pg {
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--blue);
    border-radius: 9px;
    padding: 8px 12px;
    cursor: pointer;
    min-width: 38px;
    transition: .15s;
}
.pg:hover:not(:disabled):not(.active) { background: #f1f2f8; }
.pg.active { background: var(--blue); color: var(--gold); border-color: var(--blue); }
.pg:disabled { opacity: .4; cursor: default; }

/* Delete confirmation modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 9, 40, .5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.modal.open { display: flex; }
.modal-card {
    background: var(--card);
    border-radius: 18px;
    max-width: 420px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
    text-align: center;
}
.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(229, 72, 77, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.modal-icon .material-symbols-outlined { color: #e5484d; font-size: 30px; }
.modal-title { font-size: 20px; font-weight: 800; margin: 0 0 8px; color: var(--ink); }
.modal-text { font-size: 14.5px; color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.modal-text strong { color: var(--ink); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button {
    flex: 1;
    font-family: var(--font);
    font-weight: 700;
    font-size: 15px;
    border-radius: 12px;
    padding: 13px 0;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-cancel { background: #f1f2f8; color: var(--blue); border-color: var(--line); }
.btn-cancel:hover { background: #e7e9f2; }
.btn-confirm { background: #e5484d; color: #fff; }
.btn-confirm:hover { background: #c93b40; }

/* Trash link in header */
.trash-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font);
    font-weight: 600;
    font-size: 14px;
    color: var(--blue);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    transition: .15s;
}
.trash-link:hover { background: #f1f2f8; border-color: var(--gold-deep); color: var(--blue); }
.trash-link .material-symbols-outlined { font-size: 20px; }
.trash-link .trash-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Mobile: name + ID on one line, action icons on a second line (no wrap) */
@media (max-width: 640px) {
    .wrap { padding: 20px 14px 60px; }
    thead { display: none; }
    table, tbody { display: block; }
    tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 10px;
        padding: 13px 14px;
        border-top: 1px solid var(--line);
    }
    tbody tr:first-child { border-top: 0; }
    tbody td { display: block; border: 0; padding: 0; }
    td.name {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 15.5px;
    }
    td.id { flex: 0 0 auto; }
    tbody tr > td:last-child { flex-basis: 100%; margin-top: 9px; }
    .actions {
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .actions::-webkit-scrollbar { display: none; }
    .act { width: 36px; height: 36px; flex: 0 0 auto; }
}
