:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --text: #172033;
  --muted: #687386;
  --line: #e4e9f1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e8f1ff;
  --success: #15945c;
  --warning: #dc7b13;
  --danger: #d84b4b;
  --shadow: 0 14px 35px rgba(39, 55, 83, 0.09);
  --sidebar-width: 280px;
  --topbar-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
}

body.dark {
  --bg: #0d1421;
  --surface: #141e2d;
  --surface-soft: #1a2638;
  --text: #f1f5fb;
  --muted: #9aa7ba;
  --line: #29364a;
  --primary-soft: #162c58;
  --shadow: 0 14px 35px rgba(0, 0, 0, 0.24);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(260px, 720px) 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

body.dark .topbar {
  background: rgba(20, 30, 45, 0.94);
}

.topbar-left,
.topbar-actions,
.heading-actions,
.plan-title-row,
.section-header,
.metric-card-head,
.file-name,
.dropdown-profile,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #3b82f6, #2156ce);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.icon-button,
.card-menu,
.view-switch button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 19px;
}

.icon-button:hover,
.card-menu:hover,
.view-switch button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.menu-button {
  display: none;
}

.search-box {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 14px;
  transition: 0.2s ease;
}

.search-box:focus-within {
  background: var(--surface);
  border-color: #a8c7ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-box kbd {
  padding: 3px 7px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 4px;
}

.notification-button {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.profile-button {
  min-width: 190px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding: 7px 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
}

.profile-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #17408e, #2c68d7);
  border-radius: 50%;
  font-weight: 700;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.78);
}

.profile-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.profile-copy strong,
.profile-copy small {
  max-width: 125px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: 13px;
}

.profile-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar {
  position: fixed;
  z-index: 900;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.new-button {
  min-width: 124px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 8px 20px;
  padding: 14px 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 7px 18px rgba(39, 55, 83, 0.11);
  font-weight: 600;
}

.new-button:hover {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.main-menu {
  display: grid;
  gap: 5px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: #4d5a6e;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 500;
}

body.dark .menu-item {
  color: #c0c9d7;
}

.menu-item i {
  width: 24px;
  text-align: center;
  font-size: 17px;
}

.menu-item:hover,
.menu-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.menu-divider {
  height: 1px;
  margin: 18px 10px;
  background: var(--line);
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
  padding: 0 10px;
}

.sidebar-bottom > a {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-bottom > a:hover {
  color: var(--primary);
}

.mini-storage {
  margin-bottom: 12px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.mini-storage-head {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 12px;
}

.progress {
  height: 6px;
  margin: 10px 0 8px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.mini-storage small {
  color: var(--muted);
  font-size: 11px;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 32px) 40px 54px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
  animation: fadeIn 0.28s ease;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1260px;
  margin: 0 auto 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.page-heading p:not(.eyebrow) {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.heading-actions {
  gap: 10px;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: 12px;
  font-weight: 600;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 17px;
}

.primary-button {
  color: white;
  background: var(--primary);
  box-shadow: 0 9px 20px rgba(37, 99, 235, 0.22);
}

.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  color: var(--primary);
  border-color: #b7cdfb;
  background: var(--primary-soft);
}

.primary-button.large {
  padding: 15px 25px;
  border-radius: 999px;
}

.text-button {
  padding: 8px 0;
  color: var(--primary);
  background: transparent;
}

.text-button:hover {
  color: var(--primary-dark);
}

.plan-card,
.metric-card,
.folder-card,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
}

.plan-card {
  max-width: 1260px;
  min-height: 252px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin: 0 auto;
  padding: 34px;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.section-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.plan-title-row {
  gap: 16px;
}

.plan-title-row h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.05em;
}

.plan-title-row h2 span {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  color: white;
  background: linear-gradient(135deg, #659df7, #3474e8);
  border-radius: 999px;
  font-size: 14px;
  vertical-align: middle;
}

.capacity-pill {
  display: none;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 13px;
}

.plan-info p {
  margin: 12px 0 8px;
  color: var(--muted);
}

.plan-info a {
  color: var(--primary);
  font-weight: 500;
}

.section-block {
  max-width: 1260px;
  margin: 46px auto 0;
}

.section-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.section-header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.metric-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border-radius: 20px;
  transition: 0.2s ease;
}

.metric-card:hover,
.folder-card:hover {
  border-color: #c5d6f5;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.metric-card-head {
  width: 100%;
  justify-content: space-between;
}

.metric-card h3 {
  margin: 0;
  font-size: 16px;
}

.card-menu {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.storage-chart {
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  margin: 22px 0 12px;
  background: conic-gradient(var(--primary) calc(var(--value) * 1%), var(--line) 0);
  border-radius: 50%;
}

.storage-chart::before {
  content: "";
  grid-area: 1 / 1;
  width: 92px;
  height: 92px;
  background: var(--surface);
  border-radius: 50%;
}

.storage-chart-center {
  z-index: 1;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.storage-chart-center strong {
  font-size: 25px;
}

.storage-chart-center span {
  margin-top: 3px;
  font-size: 13px;
}

.metric-caption {
  margin: 8px 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
}

.metric-icon {
  height: 110px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  font-size: 64px;
}

.cloud-upload {
  color: #5794ed;
}

.metric-status {
  font-size: 14px;
}

.cleanup-number {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #397dde;
}

.cleanup-number strong {
  font-size: 54px;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.cleanup-number span {
  font-size: 18px;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.folder-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border-radius: 17px;
  transition: 0.2s ease;
}

.folder-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 22px;
}

.folder-icon.blue {
  color: #246ee7;
  background: #e7f0ff;
}

.folder-icon.purple {
  color: #7b4bd7;
  background: #f0e9ff;
}

.folder-icon.green {
  color: #16955f;
  background: #e3f7ee;
}

.folder-icon.orange {
  color: #dc7b13;
  background: #fff0dc;
}

.folder-copy {
  min-width: 0;
  flex: 1;
}

.folder-copy strong,
.folder-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-copy strong {
  font-size: 13px;
}

.folder-copy span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.view-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.view-switch button {
  width: 36px;
  height: 32px;
  border-radius: 8px;
}

.view-switch button.active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 3px 9px rgba(28, 45, 72, 0.08);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.file-table th,
.file-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.file-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.file-table tbody tr:last-child td {
  border-bottom: 0;
}

.file-table tbody tr:hover {
  background: var(--surface-soft);
}

.file-name {
  gap: 12px;
}

.file-name > div {
  min-width: 0;
}

.file-name strong,
.file-name small {
  display: block;
}

.file-name strong {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name small {
  margin-top: 4px;
  color: var(--muted);
}

.file-icon {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 18px;
}

.file-icon.pdf {
  color: #d94343;
  background: #ffebeb;
}

.file-icon.sheet {
  color: #188d58;
  background: #e4f7ee;
}

.file-icon.image {
  color: #7351cc;
  background: #f0eaff;
}

.file-icon.archive {
  color: #ce7310;
  background: #fff0dc;
}

.dropdown {
  position: fixed;
  z-index: 1300;
  display: none;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.dropdown.open {
  display: grid;
  animation: popIn 0.16s ease;
}

.profile-dropdown {
  top: 68px;
  right: 24px;
  width: 250px;
}

.new-dropdown {
  top: 138px;
  left: 30px;
  width: 210px;
}

.dropdown button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
}

.dropdown button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.dropdown-profile {
  gap: 12px;
  margin-bottom: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.dropdown-profile div {
  min-width: 0;
}

.dropdown-profile strong,
.dropdown-profile span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-profile span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.large-avatar {
  width: 44px;
  height: 44px;
}

.modal {
  position: fixed;
  z-index: 1500;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(9, 18, 31, 0.5);
  backdrop-filter: blur(5px);
}

.modal.open {
  display: grid;
}

.modal-panel {
  width: min(440px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 55px rgba(5, 13, 27, 0.25);
  animation: modalIn 0.2s ease;
}

.modal-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.text-input {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
}

.text-input:focus {
  border-color: #8bb5ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.modal-actions {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.toast-container {
  position: fixed;
  z-index: 2000;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
}

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

.empty-page {
  max-width: 680px;
  margin: 14vh auto 0;
  padding: 48px 28px;
  text-align: center;
}

.empty-icon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 30px;
  font-size: 42px;
}

.empty-page h1 {
  margin: 0 0 12px;
  font-size: 34px;
}

.empty-page p {
  margin: 0 auto 24px;
  color: var(--muted);
  line-height: 1.7;
}

.sidebar-overlay {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 240px;
  }

  .topbar {
    grid-template-columns: var(--sidebar-width) minmax(220px, 1fr) auto;
  }

  .profile-copy,
  .profile-button > i {
    display: none;
  }

  .profile-button {
    min-width: auto;
    padding: 4px;
  }

  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto minmax(160px, 1fr) auto;
    gap: 12px;
    padding: 0 14px;
  }

  .menu-button {
    display: grid;
  }

  .brand-name {
    display: none;
  }

  .topbar-actions .icon-button:first-child,
  .topbar-actions .notification-button {
    display: none;
  }

  .sidebar {
    z-index: 1200;
    transform: translateX(-105%);
    box-shadow: 20px 0 45px rgba(15, 28, 48, 0.18);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    z-index: 1100;
    inset: var(--topbar-height) 0 0 0;
    background: rgba(9, 18, 31, 0.42);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding-right: 22px;
    padding-left: 22px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .storage-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 250px;
  }

  .profile-dropdown {
    right: 14px;
  }

  .new-dropdown {
    top: 128px;
    left: 24px;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: 66px;
  }

  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .search-box {
    height: 42px;
    padding: 0 12px;
  }

  .search-box kbd,
  .topbar-actions #themeButton {
    display: none;
  }

  .icon-button {
    width: 39px;
    height: 39px;
  }

  .avatar {
    width: 35px;
    height: 35px;
  }

  .main-content {
    padding: calc(var(--topbar-height) + 22px) 14px 38px;
  }

  .page-heading {
    display: block;
    margin-bottom: 18px;
  }

  .page-heading h1 {
    font-size: 30px;
  }

  .heading-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 18px;
  }

  .plan-card {
    min-height: auto;
    display: block;
    padding: 24px;
  }

  .plan-title-row {
    align-items: flex-start;
    justify-content: space-between;
  }

  .plan-title-row h2 {
    font-size: 29px;
  }

  .capacity-pill {
    display: inline-flex;
  }

  .plan-actions {
    margin-top: 25px;
  }

  .plan-actions .primary-button {
    width: 100%;
  }

  .section-block {
    margin-top: 34px;
  }

  .section-header {
    align-items: flex-start;
  }

  .folder-grid {
    grid-template-columns: 1fr;
  }

  .folder-card {
    padding: 15px;
  }

  .recent-section .section-header {
    align-items: center;
  }

  .toast-container {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .toast {
    min-width: 0;
  }
}

@media (max-width: 430px) {
  .heading-actions {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .plan-title-row h2 span {
    display: block;
    width: fit-content;
    margin-top: 8px;
  }

  .capacity-pill {
    margin-top: 3px;
  }

  .section-header h2 {
    font-size: 22px;
  }
}
