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

/* --- Design Tokens ------------------------------------ */
:root {
    --color-primary:        #0F172A;
    --color-primary-hover:  #1E293B;
    --color-secondary:      #10B981;
    --color-secondary-bg:   #D1FAE5;
    --color-tertiary:       #6366F1;
    --color-tertiary-bg:    #EEF2FF;
    --color-neutral:        #64748B;
    --color-neutral-50:     #F8FAFC;
    --color-neutral-100:    #F1F5F9;
    --color-neutral-200:    #E2E8F0;
    --color-neutral-300:    #CBD5E1;
    --color-text:           #0F172A;
    --color-text-muted:     #64748B;
    --color-white:          #FFFFFF;
    --color-danger:         #EF4444;
    --color-danger-bg:      #FEF2F2;
    --color-success-bg:     #F0FDF4;
    --font:                 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-width:        210px;
    --topbar-height:        64px;
    --radius-sm:            6px;
    --radius-md:            10px;
    --radius-lg:            14px;
    --shadow-sm:            0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:            0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
}

/* --- Reset -------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-neutral-100);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-tertiary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; }

/* --- App Shell ---------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

/* --- Sidebar ------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

.sidebar-brand:hover { text-decoration: none; }

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--color-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg { width: 20px; height: 20px; color: #fff; }

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.3; }

.sidebar-title {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
}

.sidebar-subtitle {
    color: rgba(255,255,255,.4);
    font-size: 11px;
}

.sidebar-nav {
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.sidebar-section-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 14px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.6);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    text-decoration: none;
    position: relative;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .75; }

.nav-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
    background: rgba(16,185,129,.14);
    color: var(--color-secondary);
}

.nav-item.active svg { opacity: 1; }

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--color-secondary);
    border-radius: 0 2px 2px 0;
}

/* --- Main Area ---------------------------------------- */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* --- Topbar ------------------------------------------- */
.topbar {
    height: var(--topbar-height);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-neutral-100);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    flex: 1;
    max-width: 420px;
    position: relative;
    min-width: 240px;
}

.topbar-search svg { width: 15px; height: 15px; color: var(--color-neutral); flex-shrink: 0; }

.topbar-search input {
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--color-text);
    width: 100%;
    outline: none;
    padding: 0;
    max-width: none;
}

.topbar-search input:focus { box-shadow: none; }

.topbar-search input::placeholder { color: var(--color-neutral); }

.topbar-search:focus-within {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px var(--color-secondary-bg);
}

.topbar-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .12);
    z-index: 320;
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}

.topbar-search-dropdown.open { display: block; }

.topbar-search-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-neutral-100);
    transition: background .12s;
}

.topbar-search-option:last-child { border-bottom: none; }

.topbar-search-option:hover,
.topbar-search-option.active {
    background: var(--color-neutral-50);
    text-decoration: none;
}

.topbar-search-option-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--color-tertiary-bg);
    color: var(--color-tertiary);
}

.topbar-search-option-icon.client {
    background: var(--color-secondary-bg);
    color: var(--color-secondary);
}

.topbar-search-option-icon svg {
    width: 17px;
    height: 17px;
    color: currentColor;
}

.topbar-search-option-body {
    min-width: 0;
    flex: 1;
}

.topbar-search-option-title {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search-option-meta {
    display: block;
    font-size: 12.5px;
    color: var(--color-text-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-search-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--color-neutral-200);
    background: transparent;
    cursor: pointer;
    color: var(--color-neutral);
    transition: background .15s;
}

.topbar-icon-btn:hover { 
    background: var(--color-neutral-100);
    text-decoration: none;
}
.topbar-icon-btn svg { width: 15px; height: 15px; }

.topbar-help-mark {
    display: block;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
}

.topbar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    border: none;
    font-family: var(--font);
}

/* --- Burger Button ------------------------------------ */
.burger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    color: var(--color-neutral);
    flex-shrink: 0;
    padding: 0;
}

.burger-btn svg { width: 18px; height: 18px; }

/* --- Profile Dropdown --------------------------------- */
.profile-wrap {
    position: relative;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.open { display: block; }

.profile-dropdown-header {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-dropdown-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text);
}

.profile-dropdown-role {
    font-size: 12px;
    color: var(--color-neutral);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--color-neutral-200);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--color-text);
    text-decoration: none;
    transition: background .12s;
}

.profile-dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-neutral); }

.profile-dropdown-item:hover {
    background: var(--color-neutral-100);
    text-decoration: none;
}

.profile-dropdown-item--danger { color: var(--color-danger); }
.profile-dropdown-item--danger svg { color: var(--color-danger); }
.profile-dropdown-item--danger:hover { background: #fef2f2; }

/* --- Sidebar Overlay (mobile) ------------------------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}

.sidebar-open .sidebar-overlay { display: block; }

/* --- Page Content ------------------------------------- */
.page-content {
    padding: 28px 28px 56px;
    flex: 1;
}

/* --- Card --------------------------------------------- */
.card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-neutral-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-neutral-200);
}

.card-header h2,
.card-header h3 {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--color-text);
}

.card-header a {
    font-size: 13px;
    color: var(--color-secondary);
    font-weight: 500;
}

/* --- Buttons ------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background .15s;
    text-decoration: none;
    line-height: 1.2;
}

.btn:hover { text-decoration: none; }

.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary { background: var(--color-neutral-100); color: var(--color-text); border: 1px solid var(--color-neutral-200); }
.btn-secondary:hover { background: var(--color-neutral-200); }

.btn-green     { background: var(--color-secondary); color: #fff; }
.btn-green:hover { background: #0ea371; }

.btn-outlined  { background: transparent; color: var(--color-text); border: 1px solid var(--color-neutral-300); }
.btn-outlined:hover { background: var(--color-neutral-100); }

.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}

.btn-icon:hover { opacity: .85; text-decoration: none; }
.btn-icon svg   { width: 15px; height: 15px; }

.btn-icon-edit   { background: var(--color-tertiary); color: #fff; }
.btn-icon-delete { background: var(--color-danger);   color: #fff; }

/* --- Alerts ------------------------------------------- */
.alert {
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    border: 1px solid;
}

.alert-error   { color: #991b1b; border-color: #fecaca; background: var(--color-danger-bg); }
.alert-success { color: #166534; border-color: #bbf7d0; background: var(--color-success-bg); }

/* --- Tag badge ---------------------------------------- */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    background: var(--color-neutral-100);
    color: var(--color-neutral);
    border: 1px solid var(--color-neutral-200);
}

.tag-color-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Forms -------------------------------------------- */
label {
    display: block;
    margin-bottom: 5px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    max-width: 480px;
    padding: 9px 12px;
    border: 1px solid var(--color-neutral-300);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-tertiary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

textarea { min-height: 90px; resize: vertical; }

.field { margin-bottom: 16px; }

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-neutral-200);
    box-shadow: var(--shadow-sm);
}

.filter-form .field { margin-bottom: 0; }

.filter-actions { display: flex; align-items: flex-end; gap: 8px; }

.checkbox-field label,
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    max-width: 700px;
}

.ajax-checkbox-search { margin-bottom: 10px; }
.custom-field-settings.is-hidden { visibility: hidden; }

/* --- Tables (general) --------------------------------- */
.table-wrap {
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-neutral-200);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* ---- Filter Bar (compact row above table) ------------ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    flex-shrink: 0;
    font-family: inherit;
    transition: background .12s, border-color .12s;
}

.filter-bar-btn:hover { background: var(--color-neutral-50); border-color: var(--color-neutral); }

.filter-bar-btn.active {
    background: var(--color-tertiary-bg);
    border-color: var(--color-tertiary);
    color: var(--color-tertiary);
}

.filter-bar-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.filter-bar-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 20px;
    background: var(--color-tertiary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.filter-bar-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 6px 0 10px;
    background: var(--color-tertiary-bg);
    color: var(--color-tertiary);
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background .12s;
}

.filter-chip:hover { background: #dde4fb; text-decoration: none; }

.filter-chip-x {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    opacity: .5;
    transition: opacity .12s;
}

.filter-chip:hover .filter-chip-x { opacity: .9; }

.filter-bar-reset {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--color-neutral);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-bar-reset:hover { color: var(--color-danger); text-decoration: none; }

/* ---- Filter Panel (collapsible form container) ------- */
.filter-panel {
    display: none;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 20px 16px;
    margin-bottom: 20px;
    animation: filterSlideDown .15s ease;
}

@keyframes filterSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filter-panel.open { display: block; }

.filter-panel .filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 16px;
    margin-bottom: 14px;
}

.filter-panel .field { margin-bottom: 0; }

.filter-panel label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-neutral);
    margin-bottom: 4px;
    text-transform: none;
}

.filter-panel input[type="text"],
.filter-panel input[type="date"],
.filter-panel select {
    max-width: 100%;
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-neutral-300);
    background: var(--color-white);
    color: var(--color-text);
    height: 34px;
}

.filter-panel select { appearance: auto; }

.filter-panel input:focus,
.filter-panel select:focus {
    outline: none;
    border-color: var(--color-tertiary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.filter-panel .filter-grid--extra {
    display: none;
    border-top: 1px solid var(--color-neutral-100);
    padding-top: 14px;
    margin-top: 2px;
    margin-bottom: 14px;
}

.filter-panel .filter-grid--extra.open { display: grid; }

.filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

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

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--color-neutral);
    cursor: pointer;
    transition: color .15s;
}

.filter-toggle-btn:hover { background: transparent; color: var(--color-text); }

.filter-toggle-chevron {
    width: 10px;
    height: 6px;
    flex-shrink: 0;
    transition: transform .2s ease;
}

.filter-toggle-btn.open .filter-toggle-chevron { transform: rotate(180deg); }

/* ---- Actions Panel (bulk-action collapsible panel) ---- */
.actions-panel {
    display: none;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
    animation: filterSlideDown .15s ease;
}

.actions-panel.open { display: block; }

.actions-panel-body {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0;
}

.actions-panel-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 180px;
    padding-right: 24px;
}

.actions-panel-sep {
    width: 1px;
    background: var(--color-neutral-200);
    align-self: stretch;
    margin-right: 24px;
    flex-shrink: 0;
}

.actions-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-neutral);
}

.actions-section-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.actions-section-picker {
    flex: 1;
    min-width: 150px;
}

.actions-section-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
    padding-top: 1px;
}

.actions-panel-section--danger .actions-section-label { color: var(--color-danger); }

/* Prevent delete button from stretching in column-flex section */
.actions-panel-section--danger { align-items: flex-start; }

.actions-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 14px;
    border-top: 1px solid var(--color-neutral-100);
}

.actions-selected-hint {
    font-size: 12.5px;
    color: var(--color-neutral);
}

/* Use .actions-panel-footer parent for higher specificity than admin.css button { background: #1f2933 } */
.actions-panel-footer .actions-deselect-btn {
    display: inline-flex;
    align-items: center;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    background-color: transparent;
    border: none;
    padding: 0;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--color-neutral);
    cursor: pointer;
    transition: color .12s;
}

.actions-panel-footer .actions-deselect-btn:hover { color: var(--color-danger); background: transparent; }

.actions-bar-btn--has-items {
    background: var(--color-neutral-50);
    border-color: var(--color-neutral);
}

.col-select {
    width: 42px;
    text-align: center;
}

.col-select input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    max-width: none;
    padding: 0;
    flex-shrink: 0;
    border: 1.5px solid var(--color-neutral-300);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: border-color .12s, background .12s;
    vertical-align: middle;
}

.col-select input[type="checkbox"]:hover {
    border-color: var(--color-secondary);
}

.col-select input[type="checkbox"]:checked,
.col-select input[type="checkbox"]:indeterminate {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
}

.col-select input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.col-select input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 5px;
    width: 8px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 10px 16px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-neutral-200);
    font-size: 13.5px;
}

th {
    background: var(--color-neutral-50);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-neutral);
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--color-neutral-50); }

/* --- Pagination --------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    font-size: 13.5px;
}

/* --- Page header -------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
}

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Auth page ---------------------------------------- */
.auth-body {
    min-height: 100vh;
    background: var(--color-neutral-100);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-box {
    width: 100%;
    max-width: 430px;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
}

.auth-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--color-secondary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-logo svg {
    width: 21px;
    height: 21px;
}

.auth-brand-title,
.auth-brand-subtitle {
    display: block;
    line-height: 1.3;
}

.auth-brand-title {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 700;
}

.auth-brand-subtitle {
    color: var(--color-text-muted);
    font-size: 12px;
}

.auth-header {
    margin-bottom: 22px;
}

.auth-header h1 {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 7px;
}

.auth-header p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.auth-form .field {
    margin-bottom: 15px;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    max-width: none;
    height: 42px;
}

.password-field {
    position: relative;
}

.password-field input[type="password"],
.password-field input[type="text"] {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .15s, color .15s;
}

.password-toggle:hover {
    background: var(--color-neutral-100);
    color: var(--color-text);
}

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.password-toggle-icon {
    display: block;
    width: 18px;
    height: 18px;
}

.password-toggle-icon-hide {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-icon-show {
    display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle-icon-hide {
    display: block;
}

.auth-code-input {
    text-align: center;
    letter-spacing: .18em;
    font-weight: 700;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    min-height: 42px;
}

.auth-secondary-form {
    margin-top: 12px;
}

.auth-secondary-form button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

/* --- Token Picker ------------------------------------- */
.token-picker {
    position: relative;
}

/* The bordered input box */
.token-picker-field {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 5px 10px;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-300);
    border-radius: var(--radius-sm);
    cursor: text;
    transition: border-color .15s, box-shadow .15s;
}

.token-picker-field:focus-within {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px var(--color-secondary-bg);
}

/* Specificity (0,3,0) beats filter-context rules such as
   .clients-filters input[type="text"] (0,2,1) that would add
   border/height/background to the inner input. */
.token-picker .token-picker-field .token-picker-input {
    flex: 1;
    min-width: 80px;
    width: 100%;
    max-width: none;
    height: auto;
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--color-text);
    padding: 2px 0;
}

/* Chips shown below the field */
.token-picker-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.token-picker-tokens:empty { margin-top: 0; }

.token-picker--filter .token-picker-field {
    min-height: 34px;
    padding: 3px 9px;
}

.token-picker--filter .token-picker-field .token-picker-input {
    font-size: 13px;
}

.token-picker--filter .token-picker-tokens {
    gap: 4px;
    margin-top: 6px;
}

.token-picker--filter .token-chip {
    padding: 2px 6px 2px 8px;
    font-size: 11.5px;
}

.token-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px 3px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid var(--color-neutral-200);
    background: var(--color-neutral-100);
    color: var(--color-text);
    white-space: nowrap;
    line-height: 1.5;
}

.token-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    border-radius: 50%;
    color: inherit;
    opacity: .5;
    transition: opacity .1s, background .1s;
    flex-shrink: 0;
}

.token-chip-remove:hover { opacity: 1; background: rgba(0,0,0,.08); }

/* Dropdown */
.token-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(0,0,0,.10);
    z-index: 300;
    max-height: 220px;
    overflow-y: auto;
}

.token-picker-dropdown.open { display: block; }

.token-picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13.5px;
    cursor: pointer;
    transition: background .1s;
    user-select: none;
}

.token-picker-option:hover { background: var(--color-neutral-50); }

.token-picker-option--selected { color: var(--color-secondary); }

.token-picker-option--selected::after {
    content: '+';
    margin-left: auto;
    font-size: 13px;
    opacity: .7;
}

.token-picker-option-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.08);
}

.token-picker-empty {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

/* --- API Key Reveal Banner ----------------------------- */
.api-key-reveal {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 24px;
}

.api-key-reveal-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #dcfce7;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
}

.api-key-reveal-icon svg { width: 18px; height: 18px; }

.api-key-reveal-body { flex: 1; min-width: 0; }

.api-key-reveal-title {
    font-size: 14px;
    font-weight: 600;
    color: #14532d;
    margin-bottom: 2px;
}

.api-key-reveal-hint {
    font-size: 12.5px;
    color: #166534;
    margin-bottom: 12px;
}

.api-key-reveal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.api-key-reveal-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    background: #fff;
    border: 1px solid #86efac;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: #14532d;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.api-key-copy-btn {
    flex-shrink: 0;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s;
}

.api-key-copy-btn:hover { background: #15803d; }

/* --- Responsive --------------------------------------- */
@media (max-width: 768px) {
    .filter-panel .filter-grid { grid-template-columns: repeat(2, 1fr); }
    .selection-bar { left: 16px; right: 16px; }

    .actions-panel { padding: 14px 16px; }
    .actions-panel-body { flex-direction: column; gap: 0; }
    .actions-panel-section {
        flex: none;
        width: 100%;
        padding-right: 0;
        padding-bottom: 14px;
    }
    .actions-panel-sep {
        width: 100%;
        height: 1px;
        align-self: auto;
        margin-right: 0;
        margin-bottom: 14px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .sidebar-open .sidebar { transform: translateX(0); }

    .main-area { margin-left: 0; }

    .burger-btn { display: flex; }

    .topbar-search { display: none; }

    .page-content { padding: 20px 16px 40px; }

    .topbar { justify-content: space-between; }
}
