:root {
  font-family: "Segoe UI", Aptos, sans-serif;
  color: #242424;
  background: #f5f5f5;
  font-synthesis: none;
  --blue: #0f6cbd;
  --muted: #616161;
  --line: #e0e0e0;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button, a, input, select, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--blue); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link { position: absolute; top: -60px; left: 16px; padding: 10px; background: white; z-index: 10; }
.skip-link:focus { top: 8px; }
.site-header { background: var(--blue); color: white; }
body:not(.signed-in) .site-header { display: none; }
.header-inner { max-width: 1440px; margin: auto; padding: 0 24px; min-height: 58px; display: flex; align-items: center; gap: 40px; }
.brand { color: white; font-size: 19px; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
#navigation { display: flex; align-items: center; flex: 1; gap: 24px; min-width: 0; }
#navigation a { color: white; font-size: 14px; padding: 20px 0 17px; border-bottom: 3px solid transparent; white-space: nowrap; }
#navigation a[aria-current] { border-bottom-color: white; }
.signed-in-name { margin-left: auto; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.logout { border: 1px solid #ffffff80; color: white; background: transparent; padding: 6px 10px; border-radius: 3px; white-space: nowrap; }
main { max-width: 1440px; padding: 24px; margin: auto; }
.notice { max-width: 1392px; margin: 16px 24px 0; padding: 12px 16px; background: #fdf3f4; border: 1px solid #e7b6bd; color: #92242f; font-size: 14px; border-radius: 3px; overflow-wrap: anywhere; }
.notice.success { background: #f1faf1; border-color: #9fd89f; color: #206b20; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 4px; padding: 24px; margin-bottom: 20px; }
h1 { font-size: 26px; font-weight: 600; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
p { line-height: 1.6; }
.panel > p, .page-heading p { color: var(--muted); font-size: 14px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.page-heading p { margin: 8px 0 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.muted, .subtle, .form-note { color: var(--muted); font-size: 13px; line-height: 1.6; }

.login-panel { max-width: 410px; margin: 12vh auto 0; padding: 36px; }
.login-panel h1 { margin-bottom: 12px; font-size: 28px; }
.login-panel > p { margin: 0 0 24px; }
.login-panel .button { width: 100%; }
.login-panel .form-note { margin: 24px 0 0; }
.manual-login { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.manual-login summary { font-size: 14px; }
.setup { padding: 12px; background: #fff8e6; border: 1px solid #ecd39b; border-radius: 3px; font-size: 13px; line-height: 1.6; margin-bottom: 20px; }

.button { display: inline-flex; align-items: center; justify-content: center; background: var(--blue); border: 1px solid var(--blue); color: white; padding: 9px 16px; font-size: 14px; font-weight: 600; line-height: 1.4; border-radius: 3px; text-decoration: none; }
.button:hover { background: #0f548c; text-decoration: none; }
.button.secondary { color: #242424; background: white; border-color: #bdbdbd; }
.button.secondary:hover { background: #f5f5f5; }
.button.small { padding: 5px 9px; font-size: 12px; }
.button.danger { background: white; color: #b42332; border-color: #dda5ad; }
.button.danger:hover { background: #fdf3f4; }
.text-button { border: 0; background: transparent; font-size: inherit; padding: 0; color: var(--blue); }
.text-button:hover { text-decoration: underline; }
.text-button.danger { color: #b42332; }
label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
input:not([type=checkbox]), select { width: 100%; min-width: 0; min-height: 38px; border: 1px solid #bdbdbd; border-radius: 3px; padding: 8px 10px; color: #242424; background: white; font-size: 14px; }
input::placeholder { color: #707070; }
input[type=checkbox] { accent-color: var(--blue); width: 16px; height: 16px; flex-shrink: 0; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 3px; margin: 20px 0 0; }
.token-scopes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.token-scopes label { margin-top: 8px; }
details { font-size: 13px; line-height: 1.6; }
summary { cursor: pointer; color: var(--blue); }

.file-explorer { display: grid; grid-template-columns: 210px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 4px; background: white; min-height: calc(100vh - 108px); }
.folder-sidebar { min-width: 0; border-right: 1px solid var(--line); padding: 24px 12px; }
.folder-sidebar h2 { padding: 0 12px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.folder-sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.folder-link { display: flex; align-items: center; gap: 12px; color: #424242; font-size: 14px; padding: 11px 12px; border-radius: 3px; overflow-wrap: anywhere; }
.folder-link:hover { background: #f5f5f5; text-decoration: none; }
.folder-link[aria-current] { background: #eff6fc; color: #0f548c; font-weight: 600; }
.folder-icon { position: relative; display: inline-block; width: 22px; height: 16px; flex-shrink: 0; background: #f9cc62; border: 1px solid #cb9a33; border-radius: 2px; }
.folder-icon::before { content: ""; position: absolute; top: -5px; left: -1px; width: 10px; height: 5px; background: #f9cc62; border: 1px solid #cb9a33; border-bottom: 0; border-radius: 2px 2px 0 0; }
.folder-storage { border-top: 1px solid var(--line); margin: 28px 12px 0; padding-top: 16px; font-size: 12px; line-height: 1.6; color: var(--muted); }
progress { width: 100%; height: 6px; accent-color: var(--blue); margin-top: 10px; display: block; }
.explorer-content { padding: 24px 28px; min-width: 0; }
.explorer-content.dragging { outline: 2px dashed var(--blue); outline-offset: -8px; background: #f6faff; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.folder-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.folder-tabs a { display: flex; align-items: center; gap: 10px; padding: 12px 0; color: #424242; font-size: 14px; border-bottom: 2px solid transparent; }
.folder-tabs a[aria-current] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.folder-tabs a:hover { text-decoration: none; }
.folder-tabs .folder-icon { width: 18px; height: 13px; }
.file-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.file-search { margin-left: auto; width: 220px; }
.file-toolbar select { width: 150px; }
.file-help { color: var(--muted); font-size: 12px; margin: 12px 0 0; }
.upload-status { font-size: 13px; color: #206b20; min-height: 18px; margin: 10px 0; overflow-wrap: anywhere; }
.table-scroll { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th { font-weight: 600; color: #616161; font-size: 12px; white-space: nowrap; }
th, td { padding: 13px 14px; border-bottom: 1px solid #edebe9; vertical-align: middle; }
thead { border-top: 1px solid #edebe9; }
tbody tr:hover { background: #f7f7f7; }
td strong { display: block; font-size: 13px; }
td small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.folder-table td:first-child { width: 65%; }
.folder-name { display: inline-flex; align-items: center; gap: 14px; color: #242424; font-size: 14px; padding: 4px 0; }
.file-table { min-width: 760px; }
.file-name { min-width: 240px; max-width: 360px; }
.file-link { display: flex; align-items: center; gap: 12px; color: #242424; }
.file-link > span:last-child { overflow-wrap: anywhere; }
.document-icon { display: grid; place-items: center; width: 32px; height: 38px; flex-shrink: 0; border: 1px solid #a7bed0; background: #f3f8fc; border-radius: 2px; color: #0f548c; font-size: 8px; font-weight: 600; }
.file-actions { white-space: nowrap; }
.file-actions button { margin-left: 16px; }
.item-count { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.empty { padding: 60px 20px; text-align: center; font-size: 14px; color: var(--muted); border-top: 1px solid #edebe9; }
.empty strong { display: block; color: #424242; font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.integration-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.integration-grid > *, .admin-grid > * { min-width: 0; }
.callout { padding: 12px; background: #f5f5f5; font-size: 13px; color: var(--muted); line-height: 1.6; }
.mono, pre, code { font-family: Consolas, "SFMono-Regular", monospace; }
pre { background: #f5f5f5; color: #242424; padding: 18px; border: 1px solid var(--line); border-radius: 3px; overflow: auto; font-size: 12px; line-height: 1.8; white-space: pre; }
code { font-size: .9em; }
.pill { display: inline-block; padding: 4px 8px; font-size: 11px; border-radius: 3px; background: #eff6fc; color: #0f548c; }
.pill.neutral { background: #f0f0f0; color: #424242; }
.pill.warning { background: #fff4ce; color: #775b00; }
.audit-table { max-height: 330px; overflow: auto; }
dialog { border: 1px solid var(--line); border-radius: 4px; width: calc(100% - 32px); max-width: 550px; padding: 28px; color: #242424; box-shadow: 0 12px 40px #0003; }
dialog::backdrop { background: #0006; }
dialog h2 { margin-top: 0; }
dialog > form { margin-top: 20px; }
dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.secret-warning { padding: 12px; background: #fff8e6; color: #775b00; font-size: 13px; line-height: 1.6; }

@media (min-width: 1440px) {
  .notice { margin-left: auto; margin-right: auto; }
}
@media (max-width: 1000px) {
  .header-inner { gap: 24px; }
  #navigation { gap: 18px; }
  .signed-in-name { max-width: 120px; }
  .file-explorer { grid-template-columns: 175px minmax(0, 1fr); }
  .explorer-content { padding: 24px 20px; }
  .file-search { margin-left: 0; flex: 1; min-width: 180px; }
}
@media (max-width: 740px) {
  .header-inner { flex-wrap: wrap; gap: 0; padding: 16px 18px 0; }
  .brand { width: 100%; }
  #navigation { flex-basis: 100%; flex-wrap: wrap; gap: 16px; padding: 4px 0 12px; }
  #navigation a { padding: 12px 0 8px; font-size: 13px; }
  .signed-in-name { margin-left: 0; max-width: 150px; }
  .logout { margin-left: auto; font-size: 12px; }
  main { padding: 16px; }
  .notice { margin-left: 16px; margin-right: 16px; }
  .file-explorer { grid-template-columns: minmax(0, 1fr); min-height: 70vh; }
  .folder-sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 12px; }
  .folder-sidebar h2 { margin-bottom: 10px; }
  .folder-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .folder-link { padding: 10px 12px; }
  .folder-storage { margin: 14px 12px 0; padding-top: 10px; max-width: 280px; }
  .explorer-content { padding: 20px 16px; }
  .file-search { width: 100%; flex-basis: 100%; order: 3; }
  .file-toolbar select { margin-left: auto; width: 140px; }
  .integration-grid, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 20px; }
  .login-panel { margin-top: 8vh; padding: 28px; }
  .page-heading { align-items: flex-start; }
  .file-help { line-height: 1.7; }
  input:not([type=checkbox]), select { font-size: 16px; }
}
@media (max-width: 440px) {
  .form-grid, .token-scopes { grid-template-columns: minmax(0, 1fr); }
  .form-grid .full { grid-column: auto; }
  .signed-in-name { display: none; }
  #navigation { gap: 14px; }
  .login-panel { padding: 24px; }
  .file-toolbar { gap: 8px; }
  .file-toolbar .button { padding: 8px 12px; font-size: 13px; }
  .file-toolbar select { width: 130px; font-size: 13px; }
  h1 { font-size: 24px; }
}
