*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f0f1a;
    --bg2: #1a1a2e;
    --bg3: #16213e;
    --border: rgba(255, 255, 255, 0.08);
    --border2: rgba(255, 255, 255, 0.14);
    --text: #e8e6f0;
    --text2: #9896a8;
    --text3: #6b6980;
    --purple: #7F77DD;
    --purple2: #534AB7;
    --teal: #1D9E75;
    --red: #E24B4A;
    --amber: #EF9F27;
    --radius: 10px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrap {
    width: 100%;
    max-width: 380px;
    padding: 1rem;
}

.login-card {
    background: var(--bg2);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-logo {
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: center;
}

.login-card h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.login-sub {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 1.75rem;
}

.alert-error {
    background: rgba(226, 75, 74, 0.12);
    border: 0.5px solid rgba(226, 75, 74, 0.3);
    color: #f08080;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 1rem;
    text-align: left;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 12px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--purple);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 5px;
}

/* ── Buttons ── */
.btn-primary {
    padding: 10px 20px;
    background: var(--purple2);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--purple);
}

.btn-full {
    width: 100%;
}

.btn-ghost {
    padding: 9px 18px;
    background: transparent;
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text2);
}

/* ── App layout ── */
.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-add {
    padding: 8px 16px;
    background: var(--purple2);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-add:hover {
    background: var(--purple);
}

.btn-logout {
    padding: 8px 14px;
    background: transparent;
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text2);
    font-size: 13px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.btn-logout:hover {
    color: var(--text);
    border-color: var(--text2);
}

/* ── Filters ── */
.filters {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters input {
    flex: 1;
    min-width: 200px;
    padding: 9px 14px;
    background: var(--bg2);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    outline: none;
}

.filters input:focus {
    border-color: var(--purple);
}

.type-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 12px;
    background: transparent;
    border: 0.5px solid var(--border);
    border-radius: 20px;
    color: var(--text2);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover {
    border-color: var(--border2);
    color: var(--text);
}

.filter-btn.active {
    background: var(--purple2);
    border-color: var(--purple2);
    color: #fff;
}

/* ── Stats ── */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 1.25rem;
}

.stat {
    background: var(--bg2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
}

.stat-label {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.stat-val {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

/* ── Detail panel ── */
.detail-panel {
    background: var(--bg2);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.detail-title {
    font-size: 15px;
    font-weight: 600;
}

.detail-sub {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

.detail-section-label {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.cred-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 0.5px solid var(--border);
}

.cred-row:last-child {
    border-bottom: none;
}

.cred-label {
    font-size: 12px;
    color: var(--text3);
    min-width: 80px;
    flex-shrink: 0;
}

.cred-val {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    flex: 1;
    font-family: monospace;
    word-break: break-all;
}

.cred-link {
    color: var(--purple);
    text-decoration: none;
    font-family: inherit;
}

.cred-link:hover {
    text-decoration: underline;
}

.cred-toggle,
.copy-btn {
    font-size: 11px;
    color: var(--text3);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cred-toggle:hover,
.copy-btn:hover {
    color: var(--text);
    background: var(--bg3);
}

.notes-box {
    background: var(--bg3);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text2);
    line-height: 1.6;
    margin-top: 4px;
}

/* ── Table ── */
.table-wrap {
    background: var(--bg2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-head {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 0.8fr 80px;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--border2);
}

.th {
    font-size: 11px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 8px;
}

.row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.2fr 0.8fr 80px;
    padding: 0 16px;
    border-bottom: 0.5px solid var(--border);
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
}

.row:last-child {
    border-bottom: none;
}

.row:hover {
    background: var(--bg3);
}

.td {
    padding: 12px 8px;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-name {
    font-weight: 500;
}

.site-url {
    font-size: 11px;
    color: var(--text3);
    margin-top: 2px;
}

.muted {
    color: var(--text2);
}

/* ── Badges ── */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-wp {
    background: rgba(33, 117, 155, 0.15);
    color: #5bb3d0;
}

.badge-woo {
    background: rgba(127, 87, 179, 0.15);
    color: #b07fd4;
}

.badge-laravel {
    background: rgba(226, 75, 74, 0.15);
    color: #e87070;
}

.badge-static {
    background: rgba(29, 158, 117, 0.15);
    color: #4dc9a0;
}

.badge-other {
    background: rgba(136, 135, 128, 0.15);
    color: #9896a8;
}

/* ── Row actions ── */
.actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--bg3);
    color: var(--text);
    border-color: var(--border2);
}

.icon-btn.danger:hover {
    background: rgba(226, 75, 74, 0.1);
    color: var(--red);
    border-color: rgba(226, 75, 74, 0.3);
}

.empty {
    padding: 3rem;
    text-align: center;
    color: var(--text3);
    font-size: 13px;
}

/* ── Modal ── */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: var(--bg2);
    border: 0.5px solid var(--border2);
    border-radius: var(--radius-lg);
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0;
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text2);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ── CKEditor Dark Theme Overrides ── */
:root {
    --ck-color-base-background: var(--bg3);
    --ck-color-base-border: var(--border2);
    --ck-color-base-action: var(--purple);
    --ck-color-toolbar-background: var(--bg2);
    --ck-color-toolbar-border: var(--border);
    --ck-color-editable-blur-background: var(--bg3);
    --ck-color-editable-blur-border: var(--border);
    --ck-color-editable-focus-border: var(--purple);
    --ck-color-base-text: var(--text);
    --ck-color-button-default-hover-background: var(--bg3);
    --ck-color-button-default-active-background: var(--purple2);
    --ck-color-button-on-background: var(--purple2);
    --ck-color-list-background: var(--bg2);
}

.ck-reset_all,
.ck-reset_all * {
    color: var(--text) !important;
}

.ck.ck-editor__main>.ck-editor__editable {
    background: var(--bg3) !important;
    border-color: var(--border) !important;
}

.ck.ck-editor__main>.ck-editor__editable.ck-focused {
    border-color: var(--purple) !important;
}

.ck.ck-toolbar {
    background: var(--bg2) !important;
    border-color: var(--border) !important;
}

.ck.ck-button:hover {
    background: var(--bg3) !important;
}

.ck.ck-button.ck-on {
    background: var(--purple2) !important;
}

.ck.ck-list {
    background: var(--bg2) !important;
}

/* Ensure lists inside editor match project styles */
.ck-content ul,
.ck-content ol {
    padding-left: 20px !important;
    margin: 8px 0 !important;
    list-style-position: outside !important;
}

/* Fixing CKEditor text and backgrounds and hover states */
.ck.ck-editor__editable_inline {
    background: var(--bg3) !important;
    color: var(--text) !important;
}

.ck.ck-toolbar {
    background: var(--bg2) !important;
    border: 0.5px solid var(--border) !important;
}

.ck.ck-button {
    color: var(--text) !important;
    cursor: pointer !important;
}

.ck.ck-button:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.ck.ck-button.ck-on {
    background: var(--purple2) !important;
    color: white !important;
}

/* Fix for unreadable placeholders */
.ck.ck-editor__editable>.ck-placeholder::before {
    color: var(--text3) !important;
}

/* Styling formatted content in detail view */
.cred-val span ul,
.cred-val span ol {
    margin: 8px 0;
    padding-left: 20px;
    list-style-position: outside;
}

.cred-val span li {
    margin-bottom: 4px;
}

/* Styles for the detail view rich text */
.rich-view {
    flex: 1;
    overflow-x: auto;
}

.rich-view ul,
.rich-view ol {
    margin: 8px 0;
    padding-left: 20px;
}

.rich-view p {
    margin-bottom: 8px;
}

.rich-view p:last-child {
    margin-bottom: 0;
}

/* Dashboard Table Line Clamp for Work column */
.line-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    font-size: 11px;
    line-height: 1.4;
    max-height: 2.8em;
}

/* ── Nav tabs ── */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 1.5rem;
    border-bottom: 0.5px solid var(--border);
    padding-bottom: 0;
}

.nav-tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
    color: var(--text);
}

.nav-tab.active {
    color: var(--purple);
    border-bottom-color: var(--purple);
}

/* ── Service table head ── */
.svc-head {
    grid-template-columns: 2fr 1.5fr 1.5fr 0.8fr 80px !important;
}

.svc-head~#servicesList .row {
    grid-template-columns: 2fr 1.5fr 1.5fr 0.8fr 80px;
}

/* ── Service badges ── */
.badge-svc-google {
    background: rgba(66, 133, 244, 0.15);
    color: #6ba3f5;
}

.badge-svc-hosting {
    background: rgba(29, 158, 117, 0.15);
    color: #4dc9a0;
}

.badge-svc-security {
    background: rgba(226, 75, 74, 0.15);
    color: #e87070;
}

.badge-svc-theme {
    background: rgba(127, 87, 179, 0.15);
    color: #b07fd4;
}

.badge-svc-backup {
    background: rgba(239, 159, 39, 0.15);
    color: #f0b85a;
}

.badge-svc-other {
    background: rgba(136, 135, 128, 0.15);
    color: #9896a8;
}

/* ── Brute force / lockout ── */
.alert-lockout {
    background: rgba(226,75,74,0.15);
    border-color: rgba(226,75,74,0.4);
}

.attempts-bar {
    height: 3px;
    background: var(--border2);
    border-radius: 2px;
    margin-bottom: 6px;
    overflow: hidden;
}

.attempts-fill {
    height: 100%;
    background: var(--red);
    border-radius: 2px;
    transition: width 0.3s;
}

.attempts-text {
    font-size: 11px;
    color: var(--text3);
    margin-bottom: 1rem;
    text-align: center;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}