/* Smart Stock Engine — modern UI (sidebar layout, light/dark theming) */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

input, select, textarea, button {
    font-family: inherit;
}

/* ============================================
   THEME TOKENS
   ============================================ */

:root {
    --bg: #fbfbfe;
    --surface: #ffffff;
    --surface2: #f0f0fb;
    --border: #e2e1f5;
    --text: #181425;
    --text-secondary: #5f5b78;
    --text-tertiary: #9793ad;
    --accent: #4f46e5;
    --accent-fg: #ffffff;
    --dot: #ece9fb;
    --shadow: 0 1px 2px rgba(79, 70, 229, 0.06);
    --shadow-lg: 0 16px 40px rgba(79, 70, 229, 0.18);
    --success: #12b76a;
    --success-bg: #e6faf0;
    --danger: #f04438;
    --danger-bg: #fef0ef;
    --neutral-bg: #f0f0fb;
    --neutral-fg: #5f5b78;
    --star-fill: #f0b429;

    --tag-favorite-bg: #fef3c7;
    --tag-favorite-fg: #92400e;
    --tag-longterm-bg: #dbeafe;
    --tag-longterm-fg: #1e40af;
    --tag-shortterm-bg: #ede9fe;
    --tag-shortterm-fg: #5b21b6;
    --tag-momentum-bg: #ffedd5;
    --tag-momentum-fg: #9a3412;
}

/* VS Code "Dark+"-inspired palette: neutral charcoal grays with a blue accent, no purple. */
html[data-theme="dark"] {
    --bg: #1e1e1e;
    --surface: #252526;
    --surface2: #2d2d2d;
    --border: #3c3c3c;
    --text: #d4d4d4;
    --text-secondary: #b3b3b3;
    --text-tertiary: #858585;
    --accent: #0e639c;
    --accent-fg: #ffffff;
    --dot: #2a2a2a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    --success: #89d185;
    --success-bg: rgba(137, 209, 133, 0.16);
    --danger: #f14c4c;
    --danger-bg: rgba(241, 76, 76, 0.16);
    --neutral-bg: #3c3c3c;
    --neutral-fg: #cccccc;

    --tag-favorite-bg: rgba(215, 186, 125, 0.18);
    --tag-favorite-fg: #d7ba7d;
    --tag-longterm-bg: rgba(86, 156, 214, 0.18);
    --tag-longterm-fg: #569cd6;
    --tag-shortterm-bg: rgba(78, 201, 176, 0.18);
    --tag-shortterm-fg: #4ec9b0;
    --tag-momentum-bg: rgba(206, 145, 120, 0.18);
    --tag-momentum-fg: #ce9178;
}

body {
    min-height: 100vh;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .2s, color .2s;
}

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

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

/* ============================================
   LOGIN SCREEN
   ============================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--dot) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.6;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.login-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-fg);
}

.logo-badge svg {
    stroke: currentColor;
}

.login-title {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin: 0 0 28px 0;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.field-label-flex {
    flex: 1;
}

.login-card input {
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.login-footnote {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 22px 0 0 0;
}

/* ============================================
   APP SHELL
   ============================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 22px 8px;
}

.sidebar-logo-row .logo-badge {
    width: 30px;
    height: 30px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 9px;
    border: none;
    text-align: left;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    width: 100%;
}

.nav-btn svg {
    flex-shrink: 0;
}

.nav-btn:hover {
    background: var(--surface2);
}

.nav-btn.active {
    background: var(--surface2);
    color: var(--text);
    font-weight: 700;
}

.sidebar-spacer {
    flex: 1;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    width: 100%;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.user-card-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-size: 12.5px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card-role {
    font-size: 10.5px;
    color: var(--text-tertiary);
}

.logout-btn {
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.logout-btn:hover {
    color: var(--danger);
}

.main {
    flex: 1;
    min-width: 0;
    padding: 30px 36px 60px 36px;
    max-width: 1360px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-in;
}

/* ============================================
   TAB HEADER / TOOLBAR
   ============================================ */

.tab-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.tab-header h1 {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.tab-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13.5px;
}

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

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    outline: none;
}

.filter-select {
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    border: 1px solid var(--border);
}

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

.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover {
    filter: brightness(0.96);
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 6px;
}

.btn-flex {
    flex: 1;
    justify-content: center;
}

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

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--surface2);
}

.btn-icon-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    flex-shrink: 0;
}

.btn-icon-ghost:hover {
    background: var(--surface2);
    color: var(--text);
}

.btn-icon-ghost-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    flex-shrink: 0;
}

.btn-icon-ghost-sm:hover {
    color: var(--danger);
}

/* ============================================
   KEBAB / MORE-ACTIONS MENU
   ============================================ */

.menu-wrap {
    position: relative;
}

.menu-dropdown {
    position: absolute;
    right: 0;
    top: 38px;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.menu-dropdown[hidden] {
    display: none;
}

.menu-item {
    text-align: left;
    padding: 8px 10px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
}

.menu-item:hover {
    background: var(--surface2);
}

.menu-item-danger {
    color: var(--danger);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 2px;
}

/* ============================================
   TABLE / CARD
   ============================================ */

.table-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
}

.table-card-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead tr {
    background: var(--bg);
}

th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

th.th-check { width: 40px; }
th.th-right { text-align: right; }
th.th-flat { padding: 8px 4px; }

td {
    padding: 11px 14px;
    vertical-align: middle;
    border-top: 1px solid var(--border);
}

td.td-check { width: 40px; }
td.td-right { text-align: right; }
td.td-right-bold { text-align: right; font-weight: 700; }

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13.5px;
}

/* Row name/meta */
.row-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-name-primary {
    font-weight: 600;
}

.row-name-meta {
    font-size: 11.5px;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
}

.star-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.star-btn.star-on {
    color: var(--star-fill);
}

/* Tag chips */
.tag-chips {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    max-width: 220px;
}

.tag-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--neutral-bg);
    color: var(--neutral-fg);
}

.tag-chip-favorite { background: var(--tag-favorite-bg); color: var(--tag-favorite-fg); }
.tag-chip-core { background: var(--neutral-bg); color: var(--neutral-fg); }
.tag-chip-longterm { background: var(--tag-longterm-bg); color: var(--tag-longterm-fg); }
.tag-chip-shortterm { background: var(--tag-shortterm-bg); color: var(--tag-shortterm-fg); }
.tag-chip-momentum { background: var(--tag-momentum-bg); color: var(--tag-momentum-fg); }
.tag-chip-highrisk { background: var(--danger-bg); color: var(--danger); }

/* Badges (signal / status / role) */
.badge {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }

.change-positive { color: var(--success); font-weight: 700; }
.change-negative { color: var(--danger); font-weight: 700; }

/* Switch toggle (watchlist status) */
.switch-track {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    position: relative;
    background: var(--border);
    padding: 0;
}

.switch-track.active {
    background: var(--success);
}

.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: left .15s;
    display: block;
}

.switch-track.active .switch-thumb {
    left: 18px;
}

/* ============================================
   SETTINGS / ADMIN CARDS
   ============================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}

.stat-card-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card-value {
    font-size: 20px;
    font-weight: 800;
    margin-top: 6px;
}

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 16px;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-card h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.section-card-hint {
    margin: 0 0 14px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.settings-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-input {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    outline: none;
    flex: 1;
    min-width: 160px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 0 14px 0;
}

/* Signal rules */
.rule-section-badge-buy {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
}

.rule-section-badge-sell {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--danger-bg);
    color: var(--danger);
}

.rule-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rule-section-count {
    font-size: 12.5px;
    color: var(--text-tertiary);
}

.signal-rules-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.rule-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 14px;
}

.rule-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rule-name-input {
    flex: 1;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    outline: none;
}

.rule-short-name-input {
    width: 120px;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    outline: none;
}

.rule-conditions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cond-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.cond-select {
    flex: 2;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    outline: none;
    min-width: 0;
}

.cond-op-select {
    width: 56px;
    padding: 6px 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    outline: none;
    text-align: center;
}

.cond-value-input {
    width: 76px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    outline: none;
}

.add-condition-btn {
    margin-top: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
}

.rule-scope {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-scope-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.rule-scope-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.rule-scope-select {
    flex: 0 1 auto;
}

.rule-isin-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rule-isin-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 11.5px;
}

.rule-isin-chip-remove {
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.rule-isin-input {
    flex: 1;
    min-width: 200px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    outline: none;
}

/* Alert message template */
.alert-template-block {
    margin-bottom: 16px;
}

.alert-template-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    outline: none;
    resize: vertical;
}

.alert-preview-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.alert-preview {
    margin-top: 4px;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 20px;
}

.alert-preview-error {
    color: var(--danger);
}

.alert-placeholder-search {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.alert-placeholders {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 14px;
    padding-right: 4px;
}

.alert-placeholder-group {
    margin-bottom: 10px;
}

.alert-placeholder-group-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.alert-placeholder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.alert-placeholder-chip {
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 11.5px;
    cursor: pointer;
}

.alert-placeholder-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.rule-divider {
    height: 1px;
    background: var(--border);
    margin: 26px 0;
}

.signal-rules-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 20, 0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease-in;
}

.modal-overlay.open {
    display: flex;
}

.modal-panel {
    width: 100%;
    max-width: 460px;
    max-height: 86vh;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 26px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.modal-subtitle {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-panel form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-row {
    display: flex;
    gap: 10px;
}

.tag-pill-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tag-pill-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tag-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
}

.tag-pill.on {
    font-weight: 700;
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-fg);
}

.tag-custom-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.tag-custom-row input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 12.5px;
    outline: none;
}

.textarea-mono {
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 12.5px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    margin-bottom: 14px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    top: 22px;
    right: 28px;
    z-index: 500;
    background: var(--text);
    color: var(--bg);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: toastIn .18s ease-out;
    max-width: 380px;
}

.toast[hidden] {
    display: none;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 14px 22px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 880px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        padding: 10px 12px;
    }

    .sidebar-logo-row {
        padding: 0 8px 0 0;
        margin-right: 8px;
    }

    .sidebar-nav {
        flex-direction: row;
    }

    .nav-btn span {
        display: none;
    }

    .sidebar-spacer {
        display: none;
    }

    .theme-toggle-btn span {
        display: none;
    }

    .theme-toggle-btn, .user-card {
        width: auto;
        margin-bottom: 0;
        margin-left: 6px;
    }

    .user-card-info {
        display: none;
    }

    .main {
        padding: 18px;
        max-width: 100%;
    }

    .table-card-scroll {
        overflow-x: auto;
    }

    table {
        min-width: 640px;
    }
}
