:root {
    --bg: #f7f7f8;
    --text: #111114;
    --muted: #6f6f78;
    --line: rgba(145, 145, 153, 0.38);
    --glass: rgba(255, 255, 255, 0.78);
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.10);
    --radius: 24px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background:
        radial-gradient(circle at 16% 8%, rgba(238, 238, 241, 0.95), transparent 28%),
        radial-gradient(circle at 82% 0%, rgba(228, 228, 232, 0.72), transparent 26%),
        #ffffff;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.glass {
    background: linear-gradient(145deg, rgba(255,255,255,0.90), rgba(233,233,236,0.72));
    border: 1px solid var(--line);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.76);
    backdrop-filter: blur(18px);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.cloud-shell {
    min-height: 100vh;
    padding: 18px;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr;
    gap: 14px;
}

.cloud-header {
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

h1 {
    margin: 4px 0 0;
    font-size: clamp(30px, 4vw, 48px);
    letter-spacing: -0.06em;
    line-height: 1;
}

.cloud-auth,
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-pill {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(145,145,153,0.42);
    border-radius: 999px;
    padding: 0 13px;
    color: var(--muted);
    background: rgba(255,255,255,0.54);
    white-space: nowrap;
}

.status-pill.manager { color: #0f3d1d; background: rgba(226, 246, 231, 0.76); }

.button, .icon-button {
    border: 1px solid rgba(145,145,153,0.42);
    border-radius: 16px;
    min-height: 42px;
    padding: 0 15px;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
}
.button:hover, .icon-button:hover { transform: translateY(-1px); }
.button.dark { background: #050505; color: #ffffff; border-color: #050505; }
.button.soft { background: rgba(255,255,255,0.56); color: var(--text); }
.button.full, .select.full { width: 100%; }

.icon-button {
    width: 42px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.56);
    font-size: 22px;
}

.usage-card, .cloud-toolbar, .drop-zone, .file-panel {
    border-radius: var(--radius);
}

.usage-card { padding: 18px 20px; }
.usage-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 11px;
    color: var(--muted);
}
.usage-bar {
    height: 15px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(210,210,216,0.75);
    border: 1px solid rgba(145,145,153,0.26);
}
.usage-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #161616, #77777e);
    transition: width 180ms ease;
}

.cloud-toolbar {
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(200px, 1fr) auto;
    gap: 14px;
    align-items: center;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.crumb {
    border: 1px solid rgba(145,145,153,0.36);
    background: rgba(255,255,255,0.58);
    color: var(--text);
    border-radius: 999px;
    min-height: 36px;
    padding: 0 12px;
    cursor: pointer;
    white-space: nowrap;
}
.crumb::after { content: ''; }

.cloud-search, .select, .password-input {
    min-height: 42px;
    border: 1px solid rgba(145,145,153,0.42);
    border-radius: 16px;
    background: rgba(255,255,255,0.72);
    padding: 0 13px;
    outline: none;
}
.cloud-search { width: min(320px, 45vw); }
.select { min-width: 118px; }

.drop-zone {
    padding: 25px;
    text-align: center;
    border-style: dashed;
}
.drop-zone.dragging {
    background: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(218,236,255,0.82));
}
.drop-title {
    font-size: 21px;
    font-weight: 690;
    letter-spacing: -0.04em;
    margin-bottom: 6px;
}
.upload-progress {
    width: min(520px, 100%);
    height: 10px;
    margin: 16px auto 0;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(210,210,216,0.72);
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: #111114;
}

.file-panel {
    min-height: 260px;
    overflow: hidden;
}
.file-head, .file-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 130px 180px 260px;
    gap: 12px;
    align-items: center;
}
.file-head {
    padding: 13px 18px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.file-list { max-height: calc(100vh - 410px); overflow-y: auto; }
.file-row {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(145,145,153,0.20);
}
.file-row:hover { background: rgba(255,255,255,0.48); }
.file-name {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}
.file-icon {
    flex: 0 0 auto;
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.64);
    border: 1px solid rgba(145,145,153,0.28);
}
.file-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 580;
    letter-spacing: -0.02em;
}
.file-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.mini {
    min-height: 34px;
    border-radius: 12px;
    padding: 0 10px;
    font-size: 14px;
}
.empty-state {
    padding: 44px;
    text-align: center;
    color: var(--muted);
}

.dialog, .preview-dialog {
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 0;
    width: min(440px, calc(100vw - 28px));
    color: var(--text);
}
.dialog::backdrop, .preview-dialog::backdrop {
    background: rgba(255,255,255,0.68);
    backdrop-filter: blur(12px);
}
.dialog-inner { padding: 22px; }
.dialog-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}
.dialog-top h2 { margin: 0; letter-spacing: -0.04em; }
.password-input { width: 100%; margin: 16px 0 10px; }
.error-text { min-height: 22px; color: #9f1d1d; font-size: 14px; margin-bottom: 10px; }
.dialog-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

.preview-dialog {
    width: min(960px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    overflow: hidden;
}
.preview-top { padding: 16px 18px; border-bottom: 1px solid var(--line); margin: 0; }
.preview-body {
    height: min(72vh, 720px);
    overflow: auto;
    padding: 18px;
}
.preview-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 14px;
    line-height: 1.55;
}
.preview-body img, .preview-body iframe {
    width: 100%;
    height: 68vh;
    border: 0;
    object-fit: contain;
}

@media (max-width: 920px) {
    body { overflow-x: hidden; }
    .cloud-shell { padding: 10px; padding-bottom: calc(10px + var(--safe-bottom)); }
    .cloud-header { align-items: stretch; flex-direction: column; }
    .cloud-auth, .toolbar-actions { justify-content: stretch; }
    .cloud-auth > *, .toolbar-actions > * { flex: 1 1 auto; }
    .cloud-toolbar { grid-template-columns: 1fr; }
    .cloud-search { width: 100%; }
    .file-head { display: none; }
    .file-list { max-height: none; overflow: visible; }
    .file-row {
        grid-template-columns: 1fr;
        gap: 9px;
        align-items: stretch;
        padding: 16px;
    }
    .file-actions { justify-content: flex-start; }
    .mini { flex: 1 1 auto; }
    .drop-zone { padding: 20px 14px; }
}
