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

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3348;
    --text: #e8eaf0;
    --text-muted: #8b90a5;
    --primary: #4f8cff;
    --primary-hover: #3a7aef;
    --danger: #ff5c5c;
    --success: #3dd68c;
    --radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1117 0%, #1a2040 100%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

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

label {
    display: block;
    text-align: left;
    margin: 12px 0 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

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

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.btn-sm:hover {
    background: var(--border);
}

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

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

.error {
    color: var(--danger);
    margin-top: 12px;
    font-size: 0.9rem;
}

.app-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 1.3rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 600;
}

.user-limit {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--primary);
    background: rgba(79, 140, 255, 0.1);
}

.main {
    flex: 1;
    padding: 24px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.toolbar .btn-primary,
.toolbar .btn-secondary {
    width: auto;
}

.breadcrumb {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.crumb {
    cursor: pointer;
    transition: color 0.2s;
}

.crumb:hover {
    color: var(--primary);
}

.sep {
    margin: 0 4px;
}

.content-grid,
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .content-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

section h3 {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.items-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

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

.folder-item {
    cursor: pointer;
}

.folder-item:hover,
.file-item:hover {
    background: var(--surface2);
}

.item .icon {
    font-size: 1.3rem;
}

.item .name {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item .size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
}

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-actions {
    display: flex;
    gap: 6px;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-actions .btn-primary {
    width: auto;
}

.viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    flex-direction: column;
}

.viewer.show {
    display: flex;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--surface);
}

.viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}

.viewer-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius);
}

.viewer-content video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius);
}

.viewer-content iframe {
    width: 90vw;
    height: 85vh;
    border: none;
    border-radius: var(--radius);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    border-radius: var(--radius);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    z-index: 300;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-color: var(--success);
}

.toast-error {
    border-color: var(--danger);
}

.toast-info {
    border-color: var(--primary);
}
