:root {
    --bg: #f8fafd;
    --panel: #ffffff;
    --panel-2: #f1f6fd;
    --text: #1f1f1f;
    --muted: #5f6368;
    --line: #dde3ea;
    --blue: #0b57d0;
    --blue-soft: #d3e3fd;
    --green: #137333;
    --orange: #b06000;
    --red: #c5221f;
    --shadow: 0 1px 3px rgba(60, 64, 67, .15), 0 4px 8px rgba(60, 64, 67, .08);
    --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }

.app-shell { min-height: 100vh; display: flex; }
.app-shell-auth { display: block; }
.drive-sidebar {
    width: 270px;
    background: var(--bg);
    border-right: 1px solid #edf1f4;
    padding: 12px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.drive-brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px; }
.brand-logo-drive {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #34a853, #4285f4);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}
.btn-new {
    margin: 4px 8px 8px;
    border-radius: 16px;
    padding: 14px 18px;
    justify-content: flex-start;
    box-shadow: var(--shadow);
}
.nav-main,
.nav-section { display: grid; gap: 4px; }
.nav-scroll { overflow: auto; }
.nav-title {
    font-size: 12px;
    color: #80868b;
    padding: 0 14px;
    margin-top: 6px;
    text-transform: none;
    letter-spacing: normal;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    margin-right: 6px;
}
.nav-link img, .mini-icon { width: 18px; height: 18px; }
.nav-link:hover { background: #eef3fd; }
.nav-link.active {
    background: var(--blue-soft);
    color: #001d35;
    font-weight: 700;
}
.empty-note { padding: 4px 14px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 10px; padding: 4px 8px 0; }
.user-chip-drive {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid var(--line);
}
.user-avatar,
.user-bubble {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: #e8f0fe;
    color: var(--blue);
}
.user-bubble {
    text-decoration: none;
    border: 2px solid #c6dafc;
}
.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.drive-main {
    flex: 1;
    padding: 10px 16px 20px;
    min-width: 0;
}
.drive-topbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 4px 0 14px;
}
.drive-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.drive-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eaf1fb;
    border-radius: 28px;
    padding: 0 16px;
    min-height: 52px;
    max-width: 760px;
}
.drive-search input {
    border: 0;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 16px;
    color: var(--text);
}
.drive-search-icon { color: #5f6368; font-size: 19px; }
.drive-topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #3c4043;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 20px;
    text-decoration: none;
}
.icon-btn:hover { background: #edf2fa; }
.drive-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 4px 16px;
}
.drive-page-head h1 { margin: 0 0 4px; font-size: 32px; font-weight: 500; }

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    font-size: 20px;
}
.menu-toggle:hover { background: #edf2fa; }
.mobile-quicknav { display: none; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mobile-pill {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}
.mobile-pill.active { background: var(--blue-soft); border-color: #c2d7fc; color: #123055; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 14px; }
.flash { padding: 13px 15px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.flash-success { border-color: #c7e7cb; background: #edf7ee; }
.flash-error { border-color: #f0c1bf; background: #fceeee; }
.flash-warning { border-color: #f0d4ab; background: #fff6e8; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: none;
}
.card h2, .card h3 { margin-top: 0; margin-bottom: 12px; }
.card-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: #fff1f2; color: var(--red); border-color: #fecdd3; }
.form-grid { display: grid; gap: 12px; }
.form-grid.inline { grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="password"], input[type="email"], input[type="datetime-local"], select, textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #fff; color: var(--text); font: inherit;
}
input[type="file"] { width: 100%; }
input[type="checkbox"] { transform: translateY(1px); }
textarea { min-height: 120px; }
.table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 12px; border-bottom: 1px solid #edf1f4; text-align: left; vertical-align: top; font-size: 14px; }
th { color: #5f6368; font-weight: 600; background: #fff; position: sticky; top: 0; }
tr:hover td { background: #fafcff; }
.item-link { display: flex; align-items: center; gap: 10px; color: var(--text); }
.item-link img { width: 22px; height: 22px; }
.badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-role { border: 1px solid transparent; }
.badge-owner { background: #e8f0fe; color: #0b57d0; border-color: #c2d7fc; }
.badge-editor { background: #fff1dc; color: #8a4300; border-color: #f1c58c; }
.badge-viewer { background: #f1f3f4; color: #46525c; border-color: #d6dbe1; }
.badge-ext { background: #eef3fd; color: #315788; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.auth-card { max-width: 500px; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.auth-brand .brand-logo { width: 54px; height: 54px; }
.auth-card h1 { margin: 0 0 6px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.breadcrumb span.sep { color: var(--muted); }
.preview-box { background: var(--panel-2); border: 1px dashed var(--line); border-radius: 18px; padding: 12px; min-height: 220px; display: grid; place-items: center; }
.preview-box img, .preview-box video, .preview-box iframe { width: 100%; border-radius: 14px; max-height: 70vh; object-fit: contain; }
.list-compact { display: grid; gap: 10px; }
.list-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.note { padding: 12px 14px; border-radius: 14px; background: #eff6ff; border: 1px solid #bfdbfe; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.code-link, .token-box { display: block; word-break: break-all; background: #1f1f1f; color: #fff; border-radius: 14px; padding: 12px; }
.file-drop { border: 1px dashed #93c5fd; border-radius: 16px; padding: 14px; background: #f8fbff; }
.quick-actions { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quick-action { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.quick-action img { width: 24px; height: 24px; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 8px; }
.status-on { background: var(--green); }
.status-off { background: var(--red); }

@media (max-width: 1100px) {
    .grid-2, .grid-3, .kpis, .quick-actions { grid-template-columns: 1fr 1fr; }
    .form-grid.inline { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .app-shell { display: block; }
    .drive-sidebar { position: fixed; inset: 0 auto 0 0; width: 82%; max-width: 320px; height: 100vh; transform: translateX(-105%); transition: transform .2s ease; z-index: 30; }
    .drive-sidebar.open { transform: translateX(0); }
    .drive-main { padding: 10px 12px 16px; }
    .drive-topbar { gap: 10px; }
    .drive-search { min-height: 46px; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .mobile-quicknav { display: flex; }
    .grid-2, .grid-3, .kpis, .quick-actions, .form-grid.inline { grid-template-columns: 1fr; }
    .list-row { align-items: flex-start; flex-direction: column; }
    body.sidebar-open::before { content: ''; position: fixed; inset: 0; background: rgba(15, 23, 42, .32); z-index: 20; }
}
