/* Vultr-style app shell */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: #eef1f5;
}

.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0f172a;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1e293b;
  transition: width 0.2s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.app-sidebar.collapsed {
  width: 64px;
}

.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .nav-group-title,
.app-sidebar.collapsed .sidebar-footer-text {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #007bfc, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.nav-item.active {
  background: rgba(0, 123, 252, 0.18);
  color: #fff;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-item.nav-muted {
  opacity: 0.55;
}

.nav-item.nav-muted:hover {
  opacity: 0.75;
}

.nav-item.nav-priority {
  background: rgba(37, 99, 235, 0.12);
  color: #bfdbfe;
}

.nav-item.nav-priority:hover {
  background: rgba(37, 99, 235, 0.2);
  color: #fff;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

.nav-item.nav-priority .nav-badge {
  background: #2563eb;
  color: #fff;
}

.onboard-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.9rem;
}

.onboard-banner button {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

.onboard-banner button:hover {
  background: #1d4ed8;
}

  padding: 12px 10px 16px;
  border-top: 1px solid #1e293b;
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
}

.sidebar-footer a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 15;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: #f8fafc;
  color: #334155;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.sidebar-toggle-icon {
  font-size: 1.15rem;
  line-height: 1;
  display: none;
  pointer-events: none;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.topbar-link-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-create-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: #007bfc;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-create-top:hover {
  background: #0069d9;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  max-width: 240px;
}

.user-menu-trigger:hover {
  background: #f8fafc;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #007bfc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-menu-email {
  font-size: 0.82rem;
  font-weight: 500;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-chevron {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  z-index: 30;
}

.user-menu.open .user-menu-dropdown {
  display: block;
}

.user-menu-dropdown button,
.user-menu-dropdown a {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.88rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-menu-dropdown button:hover,
.user-menu-dropdown a:hover {
  background: #f1f5f9;
}

.user-menu-dropdown .logout-btn {
  color: #b91c1c;
}

.user-menu-dropdown .logout-btn:hover {
  background: #fef2f2;
}

.app-content {
  flex: 1;
  padding: 20px 24px 32px;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 480px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.search-box input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(0, 123, 252, 0.12);
}

.data-table-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: fixed;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
}

.data-table td.cell-truncate {
  overflow: hidden;
  max-width: 0;
}

.data-table td.cell-nowrap {
  white-space: nowrap;
}

.data-table col.col-name { width: 30%; }
.data-table col.col-file { width: 18%; }
.data-table col.col-narrow { width: 9%; }
.data-table col.col-actions { width: 21rem; }
.data-table col.col-check { width: 2.5rem; }

/* Share list column widths */
#share-table col:nth-child(1) { width: 22%; }
#share-table col:nth-child(2) { width: 7%; }
#share-table col:nth-child(3) { width: 6%; }
#share-table col:nth-child(4) { width: 11%; }
#share-table col:nth-child(5) { width: 14%; }
#share-table col:nth-child(6) { width: 9%; }

.data-table td.col-actions-cell,
.data-table th.col-actions-head {
  width: 21rem;
  min-width: 21rem;
  max-width: 21rem;
  vertical-align: middle;
}

.data-table .row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.data-table .row-actions button {
  padding: 5px 9px;
  font-size: 0.78rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.data-table .cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.data-table .cell-stack {
  min-width: 0;
  overflow: hidden;
}

.data-table .cell-title {
  font-weight: 600;
  color: #0f172a;
}

.data-table .cell-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 2px;
  font-family: ui-monospace, monospace;
}

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

.data-table tr:hover td {
  background: #fafbfc;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #15803d;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.status-pill.expired {
  color: #b45309;
}

.status-pill.expired .dot {
  background: #f59e0b;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions button {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  font-size: 0.78rem;
  color: #64748b;
}

.app-content .layout-inner {
  max-width: 960px;
}

.app-content .card {
  margin-bottom: 20px;
}

#create-top-btn.hidden-block {
  display: none !important;
}

#create-top-btn.hidden-block {
  display: none !important;
}

.share-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: #cbd5e1;
  color: #334155;
}

.filter-chip.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.filter-count {
  font-size: 0.72rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 999px;
}

.filter-chip.active .filter-count {
  background: #dbeafe;
  color: #1d4ed8;
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #64748b;
}

.page-size-label select {
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.78rem;
}

.page-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: #475569;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.platform-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.85rem;
}

.platform-banner a {
  color: #c2410c;
  font-weight: 600;
}

.create-layout {
  position: relative;
  min-height: 320px;
}

.create-main {
  transition: margin-right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.share-drawer-open #view-create.active .create-main {
  margin-right: 380px;
}

.create-toolbar {
  align-items: center;
}

.create-picker-hint {
  margin: 0;
  flex: 1;
}

.drive-accounts-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drive-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.drive-account-item.active {
  border-color: #93c5fd;
  background: #eff6ff;
}

.drive-account-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.drive-account-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}

.drive-account-badge {
  font-size: 0.72rem;
  color: #2563eb;
  font-weight: 600;
}

.drive-account-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Google Picker overlay — center on viewport (injected on document.body) */
.picker-dialog-bg {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
}

.picker-dialog {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  z-index: 100001 !important;
}

.share-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: min(380px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid #dadce0;
  box-shadow: -4px 0 16px rgba(60, 64, 67, 0.12);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

body.share-drawer-open .share-drawer {
  transform: translateX(0);
}

.share-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.share-drawer-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

#share-panel-sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: #64748b;
  word-break: break-all;
  line-height: 1.4;
}

.share-drawer-close {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.share-drawer-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.share-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
}

.share-drawer-submit {
  margin-top: 16px;
}

.data-table tr.row-selected td {
  background: #eff6ff;
}

.status-pill.pending {
  color: #b45309;
}

.status-pill.pending .dot {
  background: #f59e0b;
}

.data-table .col-check {
  width: 36px;
  padding-left: 12px;
  padding-right: 4px;
}

.data-table .col-check input {
  cursor: pointer;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.orders-table th {
  color: #64748b;
  font-weight: 600;
  font-size: 0.75rem;
  white-space: nowrap;
}

.orders-table td.cell-truncate {
  overflow: hidden;
  max-width: 0;
}

.orders-table td.cell-nowrap {
  white-space: nowrap;
}

.orders-table .cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.data-table .cell-clamp,
.orders-table .cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
}

.data-table .cell-clamp-2,
.orders-table .cell-clamp-2 {
  -webkit-line-clamp: 2;
}

.data-table .cell-clamp-3,
.orders-table .cell-clamp-3 {
  -webkit-line-clamp: 3;
}

.data-table td.cell-multiline,
.orders-table td.cell-multiline {
  height: auto;
  vertical-align: top;
  padding-top: 10px;
  padding-bottom: 10px;
}

.data-table .sg-truncated--overflow,
.orders-table .sg-truncated--overflow {
  cursor: help;
}

.data-table a .sg-truncated--overflow,
.orders-table a .sg-truncated--overflow {
  cursor: pointer;
}

.data-table .sg-truncated--pinned,
.orders-table .sg-truncated--pinned {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-radius: 2px;
}

.sg-cell-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: min(420px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .app-sidebar.collapsed {
    width: 220px;
  }

  .data-table-wrap {
    overflow-x: auto;
  }

  .user-menu-email {
    display: none;
  }

  body.share-drawer-open #view-create.active .create-main {
    margin-right: 0;
  }

  .share-drawer {
    width: 100%;
    max-width: 100vw;
  }
}
