:root {
  --bg: #f4f5f3;
  --panel: #ffffff;
  --ink: #151817;
  --muted: #777d79;
  --line: #e7e9e6;
  --dark: #111315;
  --accent: #d8ff3e;
  --accent-ink: #141600;
  --danger: #c23434;
  --shadow: 0 18px 50px rgba(20, 24, 21, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #343a32 0, #111315 44%, #080909 100%); }
.login-card { width: min(430px, 100%); background: #fff; border-radius: 28px; padding: 34px; box-shadow: 0 30px 100px rgba(0,0,0,.35); }
.brand-lockup, .sidebar-brand { display: flex; align-items: center; gap: 14px; }
.brand-lockup h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.brand-lockup p { margin: 4px 0 0; color: var(--muted); }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--dark); color: #fff; font-weight: 900; letter-spacing: -.08em; font-size: 19px; }
.brand-mark span { color: var(--accent); }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 14px; }
.login-form { margin-top: 30px; display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; }
.login-form input { width: 100%; border: 1px solid var(--line); background: #fafbfa; border-radius: 14px; padding: 14px 15px; outline: 0; }
.login-form input:focus, .search-wrap:focus-within { border-color: #a7b187; box-shadow: 0 0 0 4px rgba(216,255,62,.16); }
.form-error { min-height: 18px; margin: -6px 0 0; color: var(--danger); font-size: 13px; }
.secure-note { margin-top: 16px; color: var(--muted); font-size: 12px; text-align: center; }

.primary, .secondary { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 800; transition: .18s ease; }
.primary { background: var(--dark); color: #fff; }
.primary:hover { transform: translateY(-1px); background: #242827; }
.secondary { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.secondary:hover { background: #f8f9f7; }
.wide { width: 100%; padding: 14px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 16px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; z-index: 40; }
.sidebar-brand { padding: 0 8px 6px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.new-button { padding: 13px 16px; border-radius: 14px; text-align: left; }
.nav-list { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; background: transparent; border-radius: 12px; padding: 11px 12px; color: #4d524f; font-weight: 700; text-align: left; display: flex; align-items: center; gap: 12px; }
.nav-item span { width: 22px; text-align: center; font-size: 19px; color: #7d837f; }
.nav-item:hover, .nav-item.active { background: #f2f4ef; color: var(--ink); }
.nav-item.active span { color: var(--ink); }
.logout { margin-top: auto; color: #777; }
.storage-card { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 15px; }
.storage-row { display: flex; justify-content: space-between; font-size: 12px; }
.storage-row strong { font-size: 11px; }
.progress { height: 7px; background: #eef0ec; border-radius: 99px; overflow: hidden; margin: 10px 0 8px; }
.progress i { display: block; width: 0; height: 100%; background: var(--dark); border-radius: inherit; transition: width .3s ease; }
.storage-card small { color: var(--muted); }

.main { min-width: 0; }
.topbar { height: 76px; display: flex; align-items: center; gap: 16px; padding: 0 32px; background: rgba(244,245,243,.84); border-bottom: 1px solid rgba(226,229,224,.8); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 30; }
.search-wrap { margin: 0 auto; width: min(640px, 60vw); height: 44px; border: 1px solid var(--line); border-radius: 14px; background: #fff; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.search-wrap span { font-size: 24px; color: #7a807c; transform: rotate(-16deg); }
.search-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
kbd { color: #9a9f9c; font-size: 10px; border: 1px solid var(--line); padding: 3px 6px; border-radius: 6px; background: #fafafa; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.user-chip span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--dark); color: var(--accent); font-weight: 900; }
.icon-button { border: 0; background: transparent; border-radius: 10px; width: 38px; height: 38px; display: inline-grid; place-items: center; font-size: 20px; }
.icon-button:hover { background: #f0f2ef; }
.mobile-only { display: none; }

.content { padding: 34px 34px 60px; max-width: 1500px; margin: 0 auto; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.hero-row h2 { margin: 7px 0 5px; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.045em; }
.hero-row p { margin: 0; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.breadcrumbs { min-height: 20px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.breadcrumbs button { border: 0; background: transparent; padding: 0; color: inherit; }
.breadcrumbs button:hover { color: var(--ink); }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.quick-card { border: 1px solid var(--line); background: #fff; border-radius: 18px; padding: 16px; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px; text-align: left; box-shadow: 0 7px 25px rgba(20,24,21,.025); }
.quick-card:hover { border-color: #cfd4cb; transform: translateY(-1px); }
.folder-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: #eff3e6; font-size: 22px; }
.quick-card strong, .quick-card small { display: block; }
.quick-card small { margin-top: 4px; color: var(--muted); }
.quick-card em { font-style: normal; font-size: 28px; color: #9aa09c; }

.files-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; min-height: 340px; overflow: hidden; box-shadow: var(--shadow); }
.files-toolbar { height: 62px; padding: 0 18px 0 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.files-toolbar strong { font-size: 14px; }
.muted { color: var(--muted); font-size: 12px; margin-left: 8px; }
.file-list { display: grid; }
.file-row { min-width: 0; display: grid; grid-template-columns: minmax(220px, 1.7fr) minmax(130px, .8fr) minmax(90px, .5fr) 160px; align-items: center; gap: 14px; padding: 13px 16px 13px 22px; border-bottom: 1px solid #f0f1ef; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #fafbfa; }
.file-row.header { min-height: 42px; padding-top: 9px; padding-bottom: 9px; background: #fbfcfa; color: #8b908d; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.file-name { min-width: 0; display: flex; align-items: center; gap: 11px; }
.file-name button { min-width: 0; border: 0; background: none; padding: 0; font-weight: 750; color: var(--ink); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name button:hover { text-decoration: underline; }
.file-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #f0f2ee; font-size: 17px; }
.file-meta { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button { border: 0; background: transparent; border-radius: 9px; padding: 7px 8px; color: #646a66; }
.row-actions button:hover { background: #eef0ed; color: var(--ink); }
.row-actions .danger:hover { color: var(--danger); background: #fff0f0; }
.empty-state { min-height: 280px; display: grid; place-items: center; align-content: center; text-align: center; padding: 34px; }
.empty-state > div { font-size: 40px; }
.empty-state h3 { margin: 10px 0 4px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.loading-state { min-height: 280px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid #e3e5e1; border-top-color: var(--dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.popover { position: fixed; z-index: 70; width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 7px; box-shadow: var(--shadow); }
.popover button { width: 100%; border: 0; background: transparent; border-radius: 9px; padding: 10px 11px; text-align: left; }
.popover button:hover { background: #f2f4f0; }
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10,12,11,.52); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(6px); }
.modal-card { width: min(460px, 100%); background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-head { min-height: 60px; padding: 0 18px 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head > div { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 22px; }
.modal-body label { display: grid; gap: 8px; font-weight: 700; font-size: 12px; }
.modal-body input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; outline: 0; }
.modal-actions { padding: 0 22px 22px; display: flex; justify-content: flex-end; gap: 8px; }
.preview-card { width: min(1100px, 96vw); height: min(820px, 92vh); background: #fff; border-radius: 20px; overflow: hidden; display: grid; grid-template-rows: 60px 1fr; box-shadow: 0 30px 100px rgba(0,0,0,.3); }
.preview-body { min-height: 0; background: #1b1e1d; display: grid; place-items: center; overflow: auto; }
.preview-body iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.link-button { text-decoration: none; font-size: 12px; padding: 8px 12px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 130; max-width: min(380px, calc(100vw - 44px)); background: #111315; color: #fff; border-radius: 13px; padding: 12px 15px; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: #9e2d2d; }
.sidebar-backdrop { display: none; }

@media (max-width: 950px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.16); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.28); display: block; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .search-wrap { width: 100%; }
  .user-chip b, kbd { display: none; }
  .content { padding: 24px 18px 46px; }
  .quick-grid { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: minmax(170px, 1fr) 110px 130px; }
  .file-row > :nth-child(3) { display: none; }
}

@media (max-width: 650px) {
  .login-card { padding: 26px 22px; border-radius: 22px; }
  .topbar { height: 66px; }
  .content { padding-top: 20px; }
  .hero-row { align-items: stretch; flex-direction: column; gap: 18px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions button { padding: 11px 10px; font-size: 12px; }
  .quick-grid { display: none; }
  .files-card { border-radius: 16px; }
  .file-row.header { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 13px 10px 13px 14px; }
  .file-row > :nth-child(2), .file-row > :nth-child(3) { display: none; }
  .file-name button { max-width: 55vw; }
  .row-actions button { padding: 7px 6px; }
  .search-wrap { height: 40px; }
  .preview-card { width: 100%; height: 100%; border-radius: 0; }
  .modal { padding: 0; }
  .modal-card { border-radius: 20px 20px 0 0; align-self: end; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
