:root {
    --bg: #121212;
    --bg-elevated: #1e1e1e;
    --border: #2c2c2c;
    --text: #e6e6e6;
    --text-dim: #9a9a9a;
    --accent: #4caf50;
    --danger: #e05555;
    --warn: #d9a441;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.topbar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}


/* Bootstrap-like dropdown menu: a single toggle button that reveals a
   floating menu panel. On narrow screens the same toggle collapses to a
   compact icon-only button, and the panel expands to full width below the
   header instead of floating — the classic "navbar-collapse" pattern. */

.nav-dropdown {
    position: relative;
    margin-left: auto;
}

.nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.nav-toggle:hover {
    border-color: var(--accent);
}

.nav-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 18px;
}

.nav-toggle-icon span {
    display: block;
    height: 2px;
    background: var(--text-dim);
    border-radius: 2px;
}

.nav-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    flex-direction: column;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.nav-menu.open {
    display: flex;
}

.nav-menu-item {
    padding: 10px 16px;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.nav-menu-item:hover {
    background: var(--bg);
    color: var(--accent);
    text-decoration: none;
}

@media (max-width: 600px) {
    .topbar {
        padding: 12px 16px;
    }
    .nav-toggle-label {
        display: none;
    }
    .nav-menu {
        position: absolute;
        top: calc(100% + 6px);
        left: 16px;
        right: 16px;
        width: auto;
        margin-top: 0;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.hdd-banner {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.hdd-banner.ok {
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid var(--accent);
}

.hdd-banner.warn {
    background: rgba(217, 164, 65, 0.12);
    border: 1px solid var(--warn);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.card.disabled {
    opacity: 0.55;
}

.card h3 {
    margin: 4px 0;
}

.card p {
    color: var(--text-dim);
    font-size: 0.85rem;
    min-height: 34px;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.badge-online {
    background: rgba(76, 175, 80, 0.2);
    color: var(--accent);
}

.badge-offline {
    background: rgba(224, 85, 85, 0.2);
    color: var(--danger);
}

.badge-storage-offline {
    background: rgba(217, 164, 65, 0.2);
    color: var(--warn);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #0b0b0b;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-link {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn[disabled] {
    background: var(--border);
    color: var(--text-dim);
    cursor: not-allowed;
}

.login-box {
    max-width: 340px;
    margin: 60px auto;
    background: var(--bg-elevated);
    padding: 24px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.login-box label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.login-box input,
.table input,
.table select,
form input,
form select {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.error {
    color: var(--danger);
}

.notice {
    color: var(--accent);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.table th,
.table td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.chat-window {
    min-height: 320px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.msg {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    max-width: 80%;
    font-size: 0.9rem;
}

.msg.user {
    background: var(--accent);
    color: #0b0b0b;
    margin-left: auto;
}

.msg.bot {
    background: var(--bg);
    border: 1px solid var(--border);
}

.msg.bot.error {
    color: var(--danger);
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-form input {
    flex: 1;
}

.hint {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.pwa-banner {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pwa-banner.hidden {
    display: none;
}

.pwa-banner button {
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

#pwa-dismiss-btn {
    background: transparent;
    color: var(--text-dim);
}