/* ==========================================================
   S7-200 SMART PLC 编程助手 — Cursor-inspired Design
   ========================================================== */

/* ===== Variables ===== */
:root {
    --bg-base: #0a0a0b;
    --bg-surface: #111113;
    --bg-elevated: #18181b;
    --bg-hover: #1f1f23;
    --bg-active: #27272b;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.1);
    --border-active: rgba(255, 255, 255, 0.15);
    --text-1: #fafafa;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --text-4: #52525b;
    --accent: #a78bfa;
    --accent-dim: rgba(167, 139, 250, 0.12);
    --accent-border: rgba(167, 139, 250, 0.25);
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.15);
    --radius-s: 6px;
    --radius-m: 10px;
    --radius-l: 14px;
    --radius-xl: 18px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Fira Code', monospace;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-1);
    display: flex;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-active); }

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-normal), width var(--transition-normal), opacity var(--transition-normal);
    z-index: 100;
}

.sidebar.hidden {
    transform: translateX(-100%);
    width: 0;
    opacity: 0;
    overflow: hidden;
    border: none;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 260px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-1);
    letter-spacing: -0.01em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-s);
    color: var(--accent);
}

.sidebar-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    border-radius: var(--radius-s);
    transition: all var(--transition-fast);
}

.sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-2);
}

/* New chat button */
.new-chat-btn {
    margin: 0 12px 8px;
    padding: 9px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.new-chat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-1);
}

/* Section */
.sidebar-section {
    padding: 8px 12px;
    flex: 1;
    overflow-y: auto;
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-4);
    padding: 8px 8px 6px;
    font-weight: 600;
}

.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.prompt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: none;
    border: none;
    border-radius: var(--radius-s);
    color: var(--text-3);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    width: 100%;
}

.prompt-item:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.prompt-item:hover .prompt-dot {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

.prompt-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-4);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

/* Footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-4);
}

.powered-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Main ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-base);
}

/* ===== Header ===== */
.header {
    height: 48px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.header-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: -0.01em;
}

.header-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    border-radius: var(--radius-s);
    transition: all var(--transition-fast);
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

/* ===== Chat Area ===== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ===== Welcome ===== */
.welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-content {
    text-align: center;
    max-width: 640px;
}

.welcome-badge {
    display: inline-block;
    padding: 5px 14px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    color: var(--text-1);
    margin-bottom: 16px;
}

.welcome-sub {
    font-size: 1.05rem;
    color: var(--text-3);
    line-height: 1.7;
    margin-bottom: 48px;
    font-weight: 400;
}

/* Cards */
.cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.card:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.card:hover .card-icon {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent-border);
}

.card:hover .card-arrow {
    opacity: 1;
    transform: translateX(2px);
    color: var(--accent);
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    color: var(--text-3);
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

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

.card-body h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 2px;
}

.card-body p {
    font-size: 0.8rem;
    color: var(--text-3);
}

.card-arrow {
    color: var(--text-4);
    opacity: 0;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

/* ===== Messages ===== */
.messages {
    padding: 24px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.message-row {
    padding: 16px 24px;
    animation: msgIn 0.3s ease;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 14px;
}

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

.message-row.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-s);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.message-row.user .message-avatar {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.message-row.assistant .message-avatar {
    background: var(--bg-elevated);
    color: var(--text-3);
    border: 1px solid var(--border);
}

.message-bubble {
    max-width: 78%;
    line-height: 1.75;
    font-size: 0.92rem;
}

.message-row.user .message-bubble {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-l) var(--radius-l) var(--radius-s) var(--radius-l);
    padding: 12px 18px;
    color: var(--text-1);
}

.message-row.assistant .message-bubble {
    color: var(--text-2);
    padding: 4px 0;
}

/* ===== Markdown in messages ===== */
.message-bubble h1, .message-bubble h2, .message-bubble h3,
.message-bubble h4, .message-bubble h5, .message-bubble h6 {
    color: var(--text-1);
    margin: 20px 0 8px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.message-bubble h1 { font-size: 1.25rem; }
.message-bubble h2 { font-size: 1.1rem; }
.message-bubble h3 { font-size: 1rem; }

.message-bubble p { margin: 8px 0; }
.message-bubble p:first-child { margin-top: 0; }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble ul, .message-bubble ol {
    margin: 8px 0;
    padding-left: 22px;
}

.message-bubble li { margin: 4px 0; }

.message-bubble strong {
    color: var(--text-1);
    font-weight: 600;
}

.message-bubble code {
    font-family: var(--font-mono);
    background: var(--bg-elevated);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--accent);
    border: 1px solid var(--border);
}

.message-bubble pre {
    margin: 14px 0;
    border-radius: var(--radius-m);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-surface);
}

.message-bubble pre code {
    display: block;
    padding: 18px;
    background: var(--bg-surface);
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-2);
    border: none;
}

.message-bubble blockquote {
    margin: 12px 0;
    padding: 10px 18px;
    border-left: 2px solid var(--accent-border);
    background: var(--accent-dim);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    color: var(--text-2);
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.85rem;
}

.message-bubble th, .message-bubble td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.message-bubble th {
    background: var(--bg-elevated);
    font-weight: 600;
    color: var(--text-1);
}

/* Code block wrapper */
.code-block-wrapper { position: relative; }

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 18px;
    background: var(--bg-elevated);
    font-size: 0.72rem;
    color: var(--text-4);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.copy-btn {
    padding: 3px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-3);
    font-size: 0.7rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: none;
}

.copy-btn:hover {
    background: var(--bg-active);
    border-color: var(--border-hover);
    color: var(--text-1);
}

.copy-btn.copied {
    background: var(--green-dim);
    border-color: var(--green);
    color: var(--green);
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 6px 0;
}

.typing-indicator span {
    width: 5px;
    height: 5px;
    background: var(--text-4);
    border-radius: 50%;
    animation: typingDot 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.3); }
}

/* ===== Image Preview ===== */
.image-preview {
    max-width: 820px;
    margin: 0 auto 8px;
}

.image-preview-inner {
    display: inline-flex;
    position: relative;
    border-radius: var(--radius-m);
    overflow: hidden;
    border: 1px solid var(--border);
}

.image-preview-inner img {
    max-height: 160px;
    max-width: 280px;
    object-fit: cover;
    display: block;
}

.image-preview-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background var(--transition-fast);
}

.image-preview-close:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* User uploaded image in chat */
.user-image-wrap {
    margin-bottom: 8px;
}

.user-image {
    max-height: 200px;
    max-width: 100%;
    border-radius: var(--radius-m);
    object-fit: contain;
}

/* Image upload button */
.image-upload-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-3);
    border-radius: var(--radius-s);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.image-upload-btn:hover {
    border-color: var(--accent-border);
    color: var(--accent);
    background: var(--accent-dim);
}

/* ===== Input Area ===== */
.input-area {
    padding: 12px 24px 16px;
    flex-shrink: 0;
}

.input-box {
    max-width: 820px;
    margin: 0 auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 12px 16px;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-box:focus-within {
    border-color: var(--border-active);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 1px var(--border-hover), 0 4px 24px rgba(0, 0, 0, 0.3);
}

#userInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-1);
    font-size: 0.92rem;
    font-family: var(--font-sans);
    resize: none;
    max-height: 180px;
    line-height: 1.6;
    padding: 0;
}

#userInput::placeholder {
    color: var(--text-4);
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.input-hint-text {
    font-size: 0.72rem;
    color: var(--text-4);
}

.send-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--text-1);
    color: var(--bg-base);
    border-radius: var(--radius-s);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.send-btn:hover {
    opacity: 0.85;
}

.send-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.input-footer {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-4);
    margin-top: 10px;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 200;
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .cards {
        max-width: 100%;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .message-bubble {
        max-width: 90%;
    }

    .message-row {
        padding: 12px 16px;
    }

    .input-area {
        padding: 10px 12px 14px;
    }
}

/* ===== Auth Pages ===== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-1);
    margin-bottom: 24px;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-3);
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: var(--radius-m);
    margin-bottom: 20px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-2);
}

.form-group input {
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    color: var(--text-1);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-4);
}

.form-group input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.auth-btn {
    margin-top: 6px;
    padding: 11px;
    background: var(--text-1);
    color: var(--bg-base);
    border: none;
    border-radius: var(--radius-m);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.auth-btn:hover {
    opacity: 0.85;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.82rem;
    color: var(--text-3);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Logout button in header */
.logout-btn {
    text-decoration: none;
}

/* User info in sidebar footer */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-2);
    margin-bottom: 8px;
}

/* Admin link in sidebar */
.admin-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-3);
    text-decoration: none;
    padding: 6px 0;
    margin-bottom: 6px;
    transition: color var(--transition-fast);
}

.admin-link:hover {
    color: var(--accent);
}

/* ===== Admin Page ===== */
.admin-body {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
    padding: 40px 24px;
}

.admin-container {
    width: 100%;
    max-width: 760px;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.admin-back {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: var(--radius-s);
    transition: all var(--transition-fast);
}

.admin-back:hover {
    background: var(--bg-hover);
    color: var(--text-1);
}

.admin-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.02em;
}

.admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    padding: 24px;
    margin-bottom: 20px;
}

.admin-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 16px;
}

/* Inline add-user form */
.admin-inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.admin-inline-form .form-group {
    flex: 1;
    margin: 0;
}

.admin-inline-form .form-group input {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    color: var(--text-1);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
}

.admin-inline-form .form-group input::placeholder {
    color: var(--text-4);
}

.admin-inline-form .form-group input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Admin table */
.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-weight: 600;
    color: var(--text-3);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    color: var(--text-2);
}

.admin-table tbody tr:hover {
    background: var(--bg-hover);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.admin-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 100px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.user-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 100px;
    background: var(--bg-hover);
    color: var(--text-3);
    border: 1px solid var(--border);
}

/* Admin buttons */
.admin-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg-elevated);
    color: var(--text-2);
    font-size: 0.82rem;
    font-family: var(--font-sans);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.admin-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-1);
}

.admin-btn-primary {
    background: var(--text-1);
    color: var(--bg-base);
    border-color: var(--text-1);
}

.admin-btn-primary:hover {
    opacity: 0.85;
    color: var(--bg-base);
}

.admin-btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
}

.admin-btn-danger {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.admin-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.admin-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    animation: fadeUp 0.2s ease;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-3);
    margin-bottom: 20px;
}

.modal-content .form-group {
    margin-bottom: 20px;
}

.modal-content .form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    color: var(--text-1);
    font-size: 0.9rem;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
}

.modal-content .form-group input::placeholder {
    color: var(--text-4);
}

.modal-content .form-group input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 768px) {
    .admin-body {
        padding: 20px 12px;
    }

    .admin-inline-form {
        flex-direction: column;
    }

    .admin-actions {
        flex-direction: column;
        gap: 4px;
    }
}
