@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg:            #090909;
    --bg-secondary:  #111111;
    --bg-tertiary:   #171717;
    --bg-card:       #141414;
    --border:        #252525;
    --border-mid:    #303030;
    --text:          #f0f0f0;
    --text-secondary:#9a9a9a;
    --text-muted:    #555555;
    --danger:        #c0392b;
    --danger-dim:    #2a1010;
    --success-dim:   #102a14;
    --warning-dim:   #2a2010;
    --line-spacing:  12px;
    --diagonal-color: rgba(255, 255, 255, 0.04);
}

.light-mode {
    --bg:            #f5f5f5;
    --bg-secondary:  #ebebeb;
    --bg-tertiary:   #e2e2e2;
    --bg-card:       #ffffff;
    --border:        #d8d8d8;
    --border-mid:    #c4c4c4;
    --text:          #111111;
    --text-secondary:#444444;
    --text-muted:    #888888;
    --danger:        #c0392b;
    --danger-dim:    #fce8e6;
    --success-dim:   #e6f4ea;
    --warning-dim:   #fef9e7;
    --diagonal-color: rgba(0, 0, 0, 0.025);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    color: var(--text);
    background-color: var(--bg);
    background-image: 
        linear-gradient(var(--diagonal-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--diagonal-color) 1px, transparent 1px);
    background-size: var(--line-spacing) var(--line-spacing);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

a {
    color: var(--text);
    text-decoration: none;
}

::selection {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text);
}


.btn-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    font-size: 15px;
    border-radius: 6px;
}
.btn-theme:hover {
    color: var(--text);
    border-color: var(--border-mid);
    background: rgba(128,128,128,0.06);
}

.search-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    border-radius: 6px;
    width: 200px;
    transition: border-color 0.2s;
    user-select: text;
    -webkit-user-select: text;
}
.search-input:focus { border-color: var(--border-mid); }
.search-input::placeholder { color: var(--text-muted); }

.data-table tr.row-hidden { display: none; }

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-mid);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.lua-block, .lua-block * {
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    padding: 9px 22px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    white-space: nowrap;
    border-radius: 6px;
}
.btn-primary:hover {
    background: transparent;
    color: var(--text);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-mid);
    padding: 9px 22px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    white-space: nowrap;
    border-radius: 6px;
}
.btn-secondary:hover {
    border-color: var(--text);
    background: rgba(255,255,255,0.04);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 9px 22px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    white-space: nowrap;
    border-radius: 6px;
}
.btn-danger:hover {
    background: var(--danger-dim);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    border-radius: 5px;
}
.btn-ghost:hover {
    color: var(--text);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    border-radius: 6px;
}
.btn-icon:hover {
    color: var(--text);
    border-color: var(--border-mid);
}

.custom-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-mid);
    color: var(--text);
    padding: 10px 0;
    font-size: 13px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
    user-select: text;
    -webkit-user-select: text;
    border-radius: 0;
}
.custom-input:focus {
    border-bottom-color: var(--text);
}
.custom-input::placeholder {
    color: var(--text-muted);
}

.custom-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 32px 8px 10px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555' stroke-width='1.5' stroke-linecap='square'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s;
    user-select: text;
    -webkit-user-select: text;
    width: 100%;
    border-radius: 6px;
}
.custom-select:focus {
    border-color: var(--border-mid);
}

.custom-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}
.custom-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.custom-toggle input:checked + .toggle-slider {
    background: var(--text);
}
.custom-toggle input:checked + .toggle-slider:before {
    transform: translateY(-50%) translateX(17px);
    background: var(--bg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}
.form-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.navbar {
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.navbar-logo {
    width: 28px;
    height: 28px;
    background: var(--text);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
}
.navbar-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.navbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.navbar-username {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

#notify-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.notify {
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    width: 310px;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
    pointer-events: all;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    border-radius: 8px;
    overflow: hidden;
}
.notify.notify-show {
    transform: translateX(0);
    opacity: 1;
}
.notify.notify-hide {
    transform: translateX(120%);
    opacity: 0;
}
.notify-bar {
    width: 3px;
    background: var(--border-mid);
    flex-shrink: 0;
}
.notify-success .notify-bar { background: #4a9d5c; }
.notify-error   .notify-bar { background: var(--danger); }
.notify-warning .notify-bar { background: #c0952b; }
.notify-info    .notify-bar { background: var(--text-muted); }
.notify-content {
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.notify-message {
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}
.notify-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.15s;
}
.notify-close:hover { color: var(--text); }

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.popup-overlay.popup-show {
    opacity: 1;
}
.popup-overlay.popup-show .popup-card {
    transform: translateY(0) scale(1);
}
.popup-card {
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    width: 500px;
    max-width: 92vw;
    transform: translateY(-12px) scale(0.98);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    border-radius: 10px;
    overflow: hidden;
}
.popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.popup-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.09em;
}
.popup-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.15s;
    font-family: 'Inter', sans-serif;
}
.popup-close-btn:hover { color: var(--text); }
.popup-body {
    padding: 22px 20px;
}
.popup-body .form-group:last-child {
    margin-bottom: 0;
}
.popup-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.cred-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    margin-bottom: 8px;
}
.cred-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.cred-row:last-child { border-bottom: none; }
.cred-key {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    margin-right: 16px;
}
.cred-val {
    color: var(--text);
    font-size: 12px;
    word-break: break-all;
    text-align: right;
    user-select: text;
    -webkit-user-select: text;
}
.cred-warn {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 0.02em;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.page-content {
    padding: 32px 28px;
    min-height: calc(100vh - 56px);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.page-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 400;
}
.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.breadcrumb a {
    color: var(--text-secondary);
    transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--text-muted); }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 20px;
    text-align: center;
    gap: 12px;
    border: 1px dashed var(--border-mid);
}
.empty-state-icon {
    font-size: 28px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.empty-state-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.empty-state-desc {
    font-size: 12px;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.5;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.data-table tr:last-child td {
    border-bottom: none;
}
.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
    color: var(--text);
}
.data-table .col-id {
    color: var(--text-muted);
    font-size: 10px;
    width: 50px;
}
.data-table .col-actions {
    width: 80px;
    text-align: right;
}

.table-wrapper {
    border: 1px solid var(--border);
    overflow: auto;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
}
.stat-pill-val {
    font-weight: 600;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-mid);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* Encrypted column badge */
.enc-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border: 1px solid var(--border-mid);
    border-radius: 3px;
    padding: 1px 4px;
    vertical-align: middle;
    line-height: 1.4;
    margin-left: 4px;
    text-transform: uppercase;
    user-select: none;
}

/* Custom Tooltip */
#tip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}
#tip.tip-show {
    opacity: 1;
    transform: translateY(0);
}
#tip-inner {
    background: var(--bg-secondary);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
    line-height: 1.4;
}




/* Nav Dropdown */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    background: transparent;
    border: none;
    transition: color 0.15s;
    outline: none;
}
.nav-dropdown-btn:hover {
    color: var(--text);
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-width: 140px;
    z-index: 1000;
    padding: 6px 0;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border-radius: 4px;
}

.nav-dropdown.active .nav-dropdown-content {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.nav-dropdown-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text);
}


/* Custom Checkbox */
.custom-chk {
    display: inline-block;
    position: relative;
    padding-left: 18px;
    cursor: pointer;
    user-select: none;
    height: 16px;
}
.custom-chk input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.chk-mark {
    position: absolute;
    top: 0;
    left: 0;
    height: 16px;
    width: 16px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-mid);
    border-radius: 4px;
    transition: all 0.2s;
}
.custom-chk:hover input ~ .chk-mark {
    border-color: var(--text-muted);
}
.custom-chk input:checked ~ .chk-mark {
    background-color: var(--text);
    border-color: var(--text);
}
.chk-mark:after {
    content: "";
    position: absolute;
    display: none;
}
.custom-chk input:checked ~ .chk-mark:after {
    display: block;
}
.custom-chk .chk-mark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
