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

body {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    background: #1a1b26;
    color: #c0caf5;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #1f2335;
    border-bottom: 1px solid #292e42;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header h1 {
    font-size: 1.2rem;
    color: #7aa2f7;
    font-weight: 600;
}

.logout-link {
    color: #565f89;
    text-decoration: none;
    font-size: 0.85rem;
}
.logout-link:hover {
    color: #c0caf5;
}

.status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: #565f89;
    color: #1a1b26;
}
.status.connected {
    background: #9ece6a;
    color: #1a1b26;
}
.status.error {
    background: #f7768e;
    color: #1a1b26;
}

/* Main Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.output {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    animation: slideIn 0.2s ease-out;
    display: flex;
}

.message.user {
    justify-content: flex-end;
}

.message .bubble {
    max-width: 80%;
    padding: 0.6rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
}

.message.user .bubble {
    background: #7aa2f7;
    color: #1a1b26;
    border-bottom-right-radius: 0.25rem;
}

.message.bot {
    justify-content: flex-start;
}

.message.bot .bubble {
    background: #24283b;
    color: #c0caf5;
    border-bottom-left-radius: 0.25rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.error {
    justify-content: flex-start;
}

.message.error .bubble {
    background: rgba(247, 118, 142, 0.15);
    color: #f7768e;
    border: 1px solid rgba(247, 118, 142, 0.3);
}

.message.system {
    justify-content: center;
}

.message.system .bubble {
    background: none;
    color: #565f89;
    font-style: italic;
    font-size: 0.8rem;
}

.input-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #292e42;
    background: #1f2335;
    flex-shrink: 0;
}

.input-bar input {
    flex: 1;
    background: #24283b;
    border: 1px solid #292e42;
    color: #c0caf5;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: 6px;
    outline: none;
}
.input-bar input:focus {
    border-color: #7aa2f7;
}

.input-bar button {
    background: #7aa2f7;
    color: #1a1b26;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
}
.input-bar button:hover {
    background: #89b4fa;
}
.input-bar button:disabled {
    background: #565f89;
    cursor: not-allowed;
}

/* Widgets Sidebar */
.widgets-panel {
    width: 300px;
    background: #1f2335;
    border-left: 1px solid #292e42;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.widgets-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.widget {
    background: #24283b;
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid #292e42;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.widget-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #565f89;
    margin-bottom: 0.5rem;
}

.widget-header .widget-title {
    margin-bottom: 0.5rem;
}

.widget-empty {
    color: #565f89;
    font-size: 0.8rem;
}

/* Health Widget */
.widget-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.metric-label {
    color: #565f89;
}

.metric-value {
    color: #c0caf5;
}

.metric-bar {
    height: 6px;
    background: #292e42;
    border-radius: 3px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.metric-fill.ok-cpu { background: #7aa2f7; }
.metric-fill.ok-mem { background: #9ece6a; }
.metric-fill.ok-disk { background: #bb9af7; }
.metric-fill.warning { background: #e0af68; }
.metric-fill.critical { background: #f7768e; }

.metric-footer {
    margin-top: 0.25rem;
    font-size: 0.7rem;
}

/* Container Widget */
.container-list {
    display: flex;
    flex-direction: column;
}

.container-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #292e42;
}
.container-item:last-child {
    border-bottom: none;
}

.container-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.container-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-running { background: #9ece6a; }
.dot-paused { background: #e0af68; }
.dot-stopped { background: #565f89; }

.container-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.container-name {
    font-size: 0.8rem;
    color: #c0caf5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.container-status {
    font-size: 0.65rem;
    color: #565f89;
}

.container-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Calendar Widget */
.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #292e42;
}
.event-item:last-child {
    border-bottom: none;
}

.event-time {
    flex-shrink: 0;
    width: 45px;
}

.event-hour {
    font-size: 0.75rem;
    color: #7aa2f7;
    font-weight: 600;
}

.event-badge {
    font-size: 0.6rem;
    background: #7aa2f7;
    color: #1a1b26;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.event-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.event-summary {
    font-size: 0.8rem;
    color: #c0caf5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-location {
    font-size: 0.65rem;
    color: #565f89;
}

/* Task Widget */
.task-list {
    display: flex;
    flex-direction: column;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #292e42;
}
.task-item:last-child {
    border-bottom: none;
}
.task-item.task-done {
    opacity: 0.5;
}

.task-check {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.task-check input {
    width: 14px;
    height: 14px;
    accent-color: #7aa2f7;
    cursor: pointer;
}

.task-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.task-summary {
    font-size: 0.8rem;
    color: #c0caf5;
}
.task-done .task-summary {
    text-decoration: line-through;
}

.task-due {
    font-size: 0.65rem;
    color: #e0af68;
}

/* Buttons */
.btn-icon {
    background: none;
    border: none;
    color: #565f89;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    color: #c0caf5;
    background: #292e42;
}

.btn-stop:hover { color: #f7768e; }
.btn-start:hover { color: #9ece6a; }
.btn-logs:hover { color: #7aa2f7; }
.btn-delete:hover { color: #f7768e; }
.btn-add { color: #7aa2f7; }
.btn-add:hover { color: #89b4fa; }

.btn-close {
    font-size: 1.5rem;
    line-height: 1;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #24283b;
    border: 1px solid #292e42;
    border-radius: 12px;
    padding: 1.25rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: #c0caf5;
    font-size: 1rem;
}

/* Modal Form */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    color: #a9b1d6;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: #1a1b26;
    border: 1px solid #292e42;
    color: #c0caf5;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 0.85rem;
    border-radius: 6px;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #7aa2f7;
}

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

.form-row {
    display: flex;
    gap: 0.5rem;
}
.form-row .form-group {
    flex: 1;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.form-check input {
    width: 14px;
    height: 14px;
    accent-color: #7aa2f7;
}
.form-check label {
    color: #a9b1d6;
    font-size: 0.85rem;
}

.btn-submit {
    width: 100%;
    background: #7aa2f7;
    color: #1a1b26;
    border: none;
    padding: 0.65rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 0.25rem;
}
.btn-submit:hover {
    background: #89b4fa;
}

/* Logs viewer in modal */
.logs-content {
    background: #1a1b26;
    border: 1px solid #292e42;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.75rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
    color: #a9b1d6;
}

/* Mobile Drawer */
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}
.drawer-backdrop.active {
    display: block;
}

.mobile-only {
    display: none;
}

/* Scrollbars */
.output::-webkit-scrollbar,
.widgets-scroll::-webkit-scrollbar,
.logs-content::-webkit-scrollbar {
    width: 6px;
}
.output::-webkit-scrollbar-track,
.widgets-scroll::-webkit-scrollbar-track,
.logs-content::-webkit-scrollbar-track {
    background: #1a1b26;
}
.output::-webkit-scrollbar-thumb,
.widgets-scroll::-webkit-scrollbar-thumb,
.logs-content::-webkit-scrollbar-thumb {
    background: #292e42;
    border-radius: 3px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    .widgets-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    .widgets-panel.open {
        transform: translateX(0);
    }

    .input-bar input {
        font-size: 16px;
    }
}

/* Login page styles (keep inline) */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
