.content:has(.files-page) {
 overflow: hidden;
}

.files-page {
 --page-title-size: 2rem;
 --page-title-line-height: 1.25;
 --page-title-leading: calc(
  var(--page-title-size) *
   var(--page-title-line-height)
 );
 display: flex;
 flex: 1;
 min-height: 0;
 width: 100%;
 height: 100%;
 background: var(--background);
}

.files-pane {
 display: flex;
 flex-direction: column;
 width: 260px;
 flex-shrink: 0;
 min-height: 0;
 border-right: 1px solid var(--border);
 background: var(--shell-surface);
 padding-top: calc(
  32px + var(--page-title-leading)
 );
}

.files-pane-header {
 display: flex;
 flex-direction: column;
 gap: 8px;
 padding: 0 12px 8px;
}

.files-pane-header h1 {
 margin: 0;
 font-size: var(--page-title-size);
 line-height: var(
  --page-title-line-height
 );
 font-weight: 600;
}

.files-list {
 display: flex;
 flex-direction: column;
 gap: 4px;
 flex: 1;
 min-height: 0;
 overflow: auto;
 padding: 8px 12px 16px;
}

.files-item {
 display: flex;
 align-items: center;
 gap: 8px;
 width: 100%;
 padding: 8px 12px;
 border: 0;
 border-radius: var(--radius-md);
 background: transparent;
 color: var(--foreground);
 font: inherit;
 text-align: left;
 cursor: pointer;
}

.files-item span {
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
}

.files-item:hover,
.files-item.active {
 background: var(--sidebar-item-hover);
}

.files-main {
 display: flex;
 flex-direction: column;
 flex: 1;
 min-width: 0;
 min-height: 0;
 padding: calc(
   32px + var(--page-title-leading)
  )
  24px 24px;
}

.files-main-header {
 display: flex;
 align-items: flex-start;
 justify-content: space-between;
 gap: 12px;
 margin-bottom: 16px;
}

.files-crumbs {
 display: flex;
 flex-wrap: wrap;
 align-items: center;
 gap: 4px;
 margin: 0;
 font-size: var(--text-sm);
}

.files-crumb {
 border: 0;
 background: transparent;
 color: var(--muted-foreground);
 font: inherit;
 cursor: pointer;
 padding: 0;
}

.files-crumb.current {
 color: var(--foreground);
 font-weight: 600;
 cursor: default;
}

.files-actions {
 display: flex;
 gap: 8px;
 flex-shrink: 0;
}

.files-rows {
 display: flex;
 flex-direction: column;
 gap: 4px;
 min-height: 0;
 overflow: auto;
}

.files-row {
 display: flex;
 align-items: center;
 gap: 8px;
 width: 100%;
 min-width: 0;
}

.files-row-open {
 display: flex;
 align-items: center;
 gap: 10px;
 flex: 1;
 min-width: 0;
 padding: 10px 12px;
 border: 0;
 border-radius: var(--radius-md);
 background: transparent;
 color: var(--foreground);
 font: inherit;
 text-align: left;
 cursor: pointer;
}

.files-row-open:hover {
 background: var(--sidebar-item-hover);
}

.files-row-copy {
 display: flex;
 flex-direction: column;
 min-width: 0;
}

.files-name {
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
 font-weight: 600;
 font-size: var(--text-sm);
}

.files-meta {
 font-size: var(--text-xs);
}

.files-empty {
 margin: 8px 0;
}

.files-error {
 margin-top: 8px;
}

.files-file-input {
 display: none;
}

.dropdown-item-destructive {
 color: var(--destructive);
}

.files-picker {
 display: flex;
 flex-direction: column;
 gap: 12px;
 min-height: 240px;
}

.files-picker-list {
 display: flex;
 flex-direction: column;
 gap: 4px;
 max-height: 360px;
 overflow: auto;
}

.files-picker-row {
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 8px;
 border-radius: var(--radius-md);
 cursor: pointer;
}

.files-picker-row:hover {
 background: var(--sidebar-item-hover);
}

.files-picker-text {
 display: flex;
 flex-direction: column;
 min-width: 0;
}

.files-picker-check {
 width: 16px;
 height: 16px;
 margin: 0;
 accent-color: var(--primary);
}

.dialog.files-picker-dialog {
 width: min(560px, calc(100vw - 32px));
}

@media (max-width: 720px) {
 .files-page {
  flex-direction: column;
 }

 .files-pane {
  width: 100%;
  max-height: 38%;
  border-right: none;
  border-bottom: 1px solid var(--border);
  padding-top: calc(
   16px + var(--page-title-leading)
  );
 }

 .files-main {
  padding: 16px;
 }
}

.files-drive {
 display: inline-flex;
 flex-shrink: 0;
 color: var(--muted-foreground);
}

.files-drive-synced {
 color: var(--foreground);
}

.files-drive-failed {
 color: var(--destructive);
}

.dialog-overlay:has(
 .chat-file-preview
) {
 padding: 0;
 background: rgba(15, 18, 24, 0.94);
 z-index: 80;
}

.dialog.chat-file-preview {
 width: 100vw;
 height: 100vh;
 height: 100dvh;
 max-width: none;
 max-height: none;
 padding: 0;
 border: 0;
 border-radius: 0;
 background: transparent;
 box-shadow: none;
 color: #fff;
}

.chat-file-preview-layout {
 display: flex;
 flex-direction: column;
 min-width: 0;
 min-height: 0;
 width: 100%;
 height: 100%;
}

.chat-file-preview-header {
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: 16px;
 min-height: 64px;
 padding: 10px 16px;
 background: rgba(0, 0, 0, 0.32);
}

.chat-file-preview-heading {
 display: flex;
 flex-direction: column;
 min-width: 0;
}

.chat-file-preview-name {
 overflow: hidden;
 text-overflow: ellipsis;
 white-space: nowrap;
 font-size: var(--text-sm);
}

.chat-file-preview-meta {
 font-size: var(--text-xs);
 color: rgba(255, 255, 255, 0.7);
}

.chat-file-preview-actions {
 display: flex;
 align-items: center;
 gap: 4px;
}

.chat-file-preview-mode {
 display: inline-flex;
 align-items: center;
 gap: 2px;
 margin-right: 8px;
 padding: 2px;
 border-radius: 999px;
 background: rgba(255, 255, 255, 0.12);
}

.chat-file-preview-mode-btn {
 border: 0;
 border-radius: 999px;
 padding: 4px 10px;
 background: transparent;
 color: rgba(255, 255, 255, 0.8);
 font: inherit;
 font-size: var(--text-xs);
 cursor: pointer;
}

.chat-file-preview-mode-btn.active {
 background: #fff;
 color: var(--foreground);
}

.chat-file-preview-action {
 display: inline-flex;
 align-items: center;
 justify-content: center;
 width: 36px;
 height: 36px;
 border: 0;
 border-radius: var(--radius-md);
 background: transparent;
 color: #fff;
 text-decoration: none;
 cursor: pointer;
}

.chat-file-preview-action:hover,
.chat-file-preview-action:focus-visible {
 background: rgba(255, 255, 255, 0.12);
}

.chat-file-preview-content {
 display: flex;
 flex: 1;
 min-height: 0;
 align-items: center;
 justify-content: center;
 padding: 12px 16px 24px;
}

.chat-file-preview-content.is-markdown {
 align-items: stretch;
 justify-content: center;
 padding: 12px 16px 20px;
}

.chat-file-preview-markdown {
 width: min(100%, 860px);
 height: 100%;
 min-width: 0;
 margin: 0 auto;
 overflow: auto;
 padding: 20px 24px 32px;
 border-radius: var(--radius-md);
 background: var(--background);
 color: var(--foreground);
}

.chat-file-preview-markdown p,
.chat-file-preview-markdown h1,
.chat-file-preview-markdown h2,
.chat-file-preview-markdown h3,
.chat-file-preview-markdown ul,
.chat-file-preview-markdown ol,
.chat-file-preview-markdown pre {
 margin: 0 0 0.75em;
}

.chat-file-preview-markdown h1,
.chat-file-preview-markdown h2,
.chat-file-preview-markdown h3 {
 line-height: 1.25;
}

.chat-file-preview-image {
 display: block;
 max-width: 100%;
 max-height: 100%;
 object-fit: contain;
}

.chat-file-preview-media {
 width: min(100%, 960px);
 max-height: 100%;
}

.chat-file-preview-audio {
 max-width: 560px;
}

.chat-file-preview-frame {
 width: min(100%, 1100px);
 height: 100%;
 border: 0;
 border-radius: var(--radius-md);
 background: #fff;
}

.chat-file-preview-unsupported {
 display: flex;
 flex-direction: column;
 align-items: center;
 gap: 8px;
 max-width: 28rem;
 text-align: center;
}

.chat-file-preview-unsupported p {
 margin: 0;
}
