:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #20242a;
  background: #f3f5f7;
  --accent: #d92735;
  --accent-dark: #b91f2c;
  --border: #dce1e6;
  --muted: #6d7680;
  --hover: #f6f8fa;
  --success: #1f7a56;
}

* { box-sizing: border-box; letter-spacing: 0; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #f3f5f7; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.site-header {
  position: relative;
  z-index: 5;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid #d5dae0;
  background: #fff;
}

.site-brand { min-width: 0; display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 48px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 48px;
  border-radius: 3px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.site-brand > span:last-child { min-width: 0; display: grid; }
.site-brand strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.site-brand small { margin-top: 2px; color: #7a838d; font-size: 10px; }

.site-nav { height: 72px; display: flex; align-items: stretch; gap: 28px; }
.site-nav a {
  position: relative;
  min-width: 64px;
  display: grid;
  place-items: center;
  color: #525b65;
  font-size: 13px;
  font-weight: 600;
}
.site-nav a:hover, .site-nav a.active { color: #20242a; }
.site-nav a.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.account-area { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.user-email { max-width: 210px; overflow: hidden; color: #69727c; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.login-link, .account-link, .text-button {
  padding: 7px 11px;
  border: 1px solid #ccd2d8;
  border-radius: 3px;
  color: #4a535d;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}
.login-link:hover, .account-link:hover, .account-link.active, .text-button:hover { border-color: #9fa8b1; color: #20242a; }

.home-shell { width: min(1180px, calc(100% - 36px)); margin: 34px auto 64px; }
.page-heading { min-height: 74px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-heading p, .login-panel header p, .account-panel header p { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 700; }
.page-heading h1 { margin: 0; font-size: 27px; line-height: 1.25; }
.page-date { margin-top: 23px; color: #818994; font-size: 11px; }
.notice { margin-bottom: 18px; padding: 10px 13px; border: 1px solid #e9cd88; border-radius: 4px; color: #745717; background: #fff9e9; font-size: 12px; }

.overview-band {
  min-height: 176px;
  padding: 30px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 42px;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid #d8dde3;
  background: #fff;
}
.overview-copy { max-width: 740px; }
.overview-copy > span { color: var(--accent); font-size: 10px; font-weight: 700; }
.overview-copy h2 { margin: 7px 0 10px; font-size: 21px; line-height: 1.35; }
.overview-copy p { margin: 0; color: #606a75; font-size: 12px; line-height: 1.75; }
.overview-actions { min-width: 150px; display: grid; gap: 9px; }
.secondary-link {
  min-height: 36px;
  padding: 0 15px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #cbd2d8;
  border-radius: 3px;
  color: #4f5964;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
}
.secondary-link:hover { border-color: #919ba5; color: #20242a; }

.stats-band {
  margin-top: 24px;
  min-height: 116px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #d9dee3;
  background: #fff;
}
.stats-band > div { min-width: 0; padding: 22px 24px; display: grid; align-content: center; gap: 8px; border-right: 1px solid #e2e6ea; }
.stats-band > div:last-child { border-right: 0; }
.stats-band span { color: #737c86; font-size: 11px; }
.stats-band strong { overflow: hidden; color: #292e34; font-size: 25px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.stats-band strong.date-value { font-size: 13px; font-weight: 600; }

.source-section, .capability-section, .activity-section { margin-top: 32px; }
.section-title { min-height: 42px; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.section-title h2 { margin: 0; font-size: 15px; }
.section-title span { color: #858d96; font-size: 10px; }
.source-row {
  min-height: 94px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border: 1px solid #d9dee3;
  border-radius: 4px;
  background: #fff;
}
.large-folder-icon { position: relative; width: 34px; height: 24px; border: 1px solid #d9a226; border-radius: 2px; background: #f6c74a; box-shadow: inset 0 3px 0 #ffdc77; }
.large-folder-icon::before { content: ""; position: absolute; top: -7px; left: 1px; width: 15px; height: 7px; border: 1px solid #d9a226; border-bottom: 0; border-radius: 2px 2px 0 0; background: #efbc3d; }
.source-identity { min-width: 0; }
.source-identity h3 { margin: 0 0 6px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.source-identity p { margin: 0; overflow: hidden; color: #737c86; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.source-state { padding-left: 15px; position: relative; color: #68717b; font-size: 11px; white-space: nowrap; }
.source-state::before { content: ""; position: absolute; top: 4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: #9ca4ac; }
.source-state[data-status="complete"]::before { background: var(--success); }
.source-state[data-status="running"]::before { background: #c58c18; }
.source-state[data-status="failed"]::before { background: var(--accent); }
.primary-link, .primary-button {
  min-height: 36px;
  padding: 0 17px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.primary-link:hover, .primary-button:hover:not(:disabled) { border-color: var(--accent-dark); background: var(--accent-dark); }
.primary-link[aria-disabled="true"], .primary-button:disabled { pointer-events: none; opacity: .52; }

.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #d9dee3;
  border-bottom: 1px solid #d9dee3;
  background: #fff;
}
.capability-grid article { min-width: 0; min-height: 150px; padding: 24px; border-right: 1px solid #e2e6ea; }
.capability-grid article:last-child { border-right: 0; }
.capability-index { color: var(--accent); font-size: 10px; font-weight: 800; }
.capability-grid h3 { margin: 16px 0 8px; font-size: 13px; }
.capability-grid p { margin: 0; color: #69737e; font-size: 11px; line-height: 1.65; }
.activity-line { min-height: 56px; padding: 0 18px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: #69727c; font-size: 11px; background: #fafbfc; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px #e4f2ec; }

.auth-shell { min-height: calc(100vh - 72px); padding: 56px 18px; display: grid; place-items: start center; background: #f3f5f7; }
.login-panel, .account-panel { width: min(440px, 100%); padding: 30px; border: 1px solid #d8dde3; border-radius: 5px; background: #fff; box-shadow: 0 12px 32px rgb(37 44 52 / 8%); }
.account-panel { width: min(520px, 100%); }
.login-panel header, .account-panel header { margin-bottom: 24px; }
.login-panel h1, .account-panel h1 { margin: 0; font-size: 22px; }
.login-panel form, .account-panel form { display: grid; gap: 9px; }
.login-panel label, .account-panel label { margin-top: 7px; color: #565f69; font-size: 11px; font-weight: 600; }
.login-panel input, .account-panel input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #cbd2d8; border-radius: 3px; color: #20242a; background: #fff; font-size: 13px; }
.login-panel input:focus, .account-panel input:focus, .search-field input:focus { outline: 2px solid #eaa9ae; outline-offset: 1px; border-color: var(--accent); }
.login-panel .primary-button, .account-panel .primary-button { width: 100%; margin-top: 15px; }
.auth-mode-switch { margin-bottom: 20px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border: 1px solid #d7dce1; border-radius: 4px; background: #eef1f4; }
.auth-mode-switch button { height: 34px; border: 0; border-radius: 3px; color: #69727c; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-mode-switch button[aria-selected="true"] { color: #252b31; background: #fff; box-shadow: 0 1px 3px rgb(37 44 52 / 12%); }
.auth-mode-switch button:disabled { cursor: default; opacity: .58; }
.field-heading { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-heading label { margin: 0; }
.link-button { padding: 2px 0; border: 0; color: #65707b; background: transparent; font-size: 11px; cursor: pointer; }
.link-button:hover { color: var(--accent); }
.link-button:disabled { cursor: default; opacity: .55; }
.form-field { display: grid; gap: 9px; }
.field-guidance { margin: 4px 0 0; color: #7b848e; font-size: 10px; line-height: 1.5; }
.account-summary { margin-bottom: 20px; padding: 14px 16px; display: grid; gap: 5px; border-top: 1px solid #dce1e6; border-bottom: 1px solid #dce1e6; background: #f8f9fa; }
.account-summary span { color: #7a838d; font-size: 10px; }
.account-summary strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.form-message { margin: 8px 0 0; padding: 9px 10px; border: 1px solid #b9d6ca; border-radius: 3px; color: #1d684d; background: #f1f9f6; font-size: 11px; }
.form-message[data-error="true"] { border-color: #e0a5aa; color: #982531; background: #fff4f5; }

.file-workspace { width: min(1440px, calc(100% - 36px)); min-height: calc(100vh - 108px); margin: 18px auto; border: 1px solid #d8dde3; background: #fff; }
.command-bar { min-height: 60px; padding: 12px 16px; display: grid; grid-template-columns: auto minmax(260px, 500px); align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--border); }
.nav-actions { display: flex; align-items: center; gap: 5px; }
.icon-button, .row-actions button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 3px; color: #4f5965; background: transparent; cursor: pointer; }
.icon-button { font-size: 19px; line-height: 1; }
.icon-button:hover:not(:disabled), .row-actions button:hover:not(:disabled) { border-color: #ccd3da; background: #f2f5f8; color: #222830; }
.icon-button:disabled, .row-actions button:disabled { cursor: default; opacity: .34; }
.search-field { position: relative; min-width: 0; }
.search-field input { width: 100%; height: 36px; padding: 0 34px 0 36px; border: 1px solid #cbd2d9; border-radius: 3px; color: #222830; background: #fbfcfd; font-size: 13px; }
.search-symbol { position: absolute; top: 10px; left: 13px; z-index: 1; width: 14px; height: 14px; border: 1.7px solid #6c7681; border-radius: 50%; pointer-events: none; }
.search-symbol::after { content: ""; position: absolute; right: -5px; bottom: -3px; width: 6px; height: 2px; background: #6c7681; transform: rotate(45deg); transform-origin: left center; }
.breadcrumbs { min-height: 43px; padding: 0 16px; display: flex; align-items: center; gap: 7px; overflow: hidden; border-bottom: 1px solid var(--border); color: #5f6873; font-size: 12px; white-space: nowrap; }
.breadcrumbs button { min-width: 0; padding: 3px 2px; overflow: hidden; border: 0; color: #4e5964; background: transparent; text-overflow: ellipsis; cursor: pointer; }
.breadcrumbs button:hover { color: var(--accent); }
.breadcrumb-separator { color: #a4abb3; }
.breadcrumb-current { min-width: 0; overflow: hidden; color: #242a31; font-weight: 600; text-overflow: ellipsis; }
.table-heading { min-height: 56px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: #fbfcfd; }
.table-heading > div { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.table-heading h1 { margin: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
#view-context, #result-count { color: #77818c; font-size: 11px; font-variant-numeric: tabular-nums; }
#view-context { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#result-count { white-space: nowrap; }
.file-table { min-height: 360px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.table-header, .file-row { display: grid; grid-template-columns: minmax(300px, 1fr) 160px 130px 110px 58px; align-items: center; }
.table-header { min-height: 38px; padding: 0 12px; border-bottom: 1px solid var(--border); color: #727c87; background: #fff; font-size: 11px; }
.table-header span { padding: 0 10px; border-right: 1px solid #e3e7eb; }
.table-header span:last-child { border-right: 0; text-align: center; }
.file-row { min-height: 54px; padding: 0 12px; border-bottom: 1px solid #e7eaee; background: #fff; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--hover); }
.name-cell { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 7px 10px; }
.file-icon { position: relative; width: 26px; height: 25px; flex: 0 0 26px; }
.file-icon.is-folder { width: 26px; height: 18px; margin-top: 4px; border: 1px solid #e2aa2d; border-radius: 2px; background: #f7c94f; box-shadow: inset 0 2px 0 #ffdc77; }
.file-icon.is-folder::before { content: ""; position: absolute; top: -5px; left: 1px; width: 11px; height: 5px; border: 1px solid #e2aa2d; border-bottom: 0; border-radius: 2px 2px 0 0; background: #efbd3f; }
.file-icon.is-file { border: 1px solid #aeb8c3; border-radius: 2px; background: #fff; box-shadow: inset 0 -3px 0 #7599be; }
.file-icon.is-file::after { content: ""; position: absolute; top: -1px; right: -1px; width: 7px; height: 7px; border-left: 1px solid #aeb8c3; border-bottom: 1px solid #aeb8c3; background: #edf1f5; }
.file-icon[data-group="archive"] { box-shadow: inset 0 -3px 0 #d98b36; }
.file-icon[data-group="document"] { box-shadow: inset 0 -3px 0 #d45660; }
.file-icon[data-group="sheet"] { box-shadow: inset 0 -3px 0 #3e9b70; }
.file-icon[data-group="image"] { box-shadow: inset 0 -3px 0 #7c69b4; }
.file-extension { position: absolute; right: 2px; bottom: 5px; left: 2px; overflow: hidden; color: #526273; font-size: 6px; font-weight: 800; line-height: 1; text-align: center; }
.file-identity { min-width: 0; display: grid; grid-template-columns: minmax(0, auto) 1fr; align-items: baseline; column-gap: 10px; }
.file-name { min-width: 0; padding: 2px 0; overflow: hidden; border: 0; color: #24292f; background: transparent; font-size: 13px; font-weight: 550; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-name:hover { color: #c31d2a; }
.file-id { min-width: 0; overflow: hidden; color: #a0a7af; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.file-path { grid-column: 1 / -1; margin-top: 3px; color: #76808b; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; white-space: normal; }
.file-row:has(.file-path:not([hidden])) { min-height: 72px; }
.modified, .file-type, .file-size { padding: 0 10px; overflow: hidden; color: #59636e; font-size: 11px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.file-size { text-align: right; }
.row-actions { display: flex; justify-content: center; }
.row-actions button { color: #586673; font-size: 19px; }
.row-actions .download-button { color: #1b7655; }
.table-message { min-height: 240px; padding: 72px 18px; color: #77818c; font-size: 13px; text-align: center; }
.table-message.error { color: #ad2631; }
.status-bar { min-height: 42px; padding: 0 16px; display: flex; align-items: center; gap: 18px; color: #737d88; font-size: 11px; }
.status-bar strong { color: #424a53; font-variant-numeric: tabular-nums; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(420px, calc(100vw - 32px)); padding: 10px 13px; border: 1px solid #99c8b5; border-radius: 4px; color: #145c43; background: #f0faf6; box-shadow: 0 8px 24px rgb(35 47 58 / 14%); font-size: 12px; }
.toast[data-error="true"] { border-color: #e1a4aa; color: #9d202b; background: #fff4f5; }
.download-frame { display: none; }

@media (max-width: 820px) {
  .site-header { min-height: 104px; padding: 0 16px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 60px 44px; gap: 0 14px; }
  .site-brand { grid-column: 1; grid-row: 1; }
  .brand-mark { width: 42px; height: 27px; flex-basis: 42px; }
  .site-brand strong { font-size: 14px; }
  .site-brand small { display: none; }
  .account-area { grid-column: 2; grid-row: 1; }
  .user-email { display: none; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; height: 44px; gap: 22px; border-top: 1px solid #edf0f2; }
  .site-nav a { min-width: 58px; justify-items: start; font-size: 12px; }
  .site-nav a.active::after { right: auto; width: 58px; }
  .home-shell { width: calc(100% - 28px); margin-top: 24px; }
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .stats-band > div { min-height: 92px; padding: 16px; }
  .stats-band > div:nth-child(2) { border-right: 0; }
  .stats-band > div:nth-child(-n+2) { border-bottom: 1px solid #e2e6ea; }
  .source-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 13px; }
  .source-state { grid-column: 2; justify-self: start; }
  .source-row .primary-link { grid-column: 3; grid-row: 1 / span 2; }
  .auth-shell { min-height: calc(100vh - 104px); padding-top: 34px; }
  .overview-band { padding: 24px; grid-template-columns: 1fr; gap: 22px; }
  .overview-actions { grid-template-columns: 1fr 1fr; }
  .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capability-grid article:nth-child(2) { border-right: 0; }
  .capability-grid article:nth-child(-n+2) { border-bottom: 1px solid #e2e6ea; }
  .file-workspace { width: 100%; min-height: calc(100vh - 104px); margin: 0; border: 0; }
  .command-bar { padding: 10px 12px; grid-template-columns: 1fr; gap: 9px; }
  .nav-actions { order: 2; }
  .search-field { order: 1; }
  .breadcrumbs { padding: 0 12px; }
  .table-heading { min-height: 52px; padding: 8px 12px; align-items: flex-start; }
  .table-heading > div { display: grid; gap: 2px; }
  .table-header, .file-row { grid-template-columns: minmax(0, 1fr) 48px; }
  .table-header { padding: 0 8px; }
  .file-row { min-height: 62px; padding: 0 8px; }
  .table-header span:nth-child(2), .table-header span:nth-child(3), .table-header span:nth-child(4), .modified, .file-type, .file-size { display: none; }
  .table-header span:nth-child(5) { grid-column: 2; }
  .name-cell { gap: 10px; padding: 8px 7px; }
  .file-identity { grid-template-columns: minmax(0, 1fr); }
  .file-id { margin-top: 2px; }
  .file-path { margin-top: 4px; }
  .file-row:has(.file-path:not([hidden])) { min-height: 94px; }
  .status-bar { padding: 0 12px; gap: 12px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (max-width: 520px) {
  .page-heading h1 { font-size: 23px; }
  .page-date { display: none; }
  .stats-band strong { font-size: 21px; }
  .stats-band strong.date-value { white-space: normal; }
  .source-row { padding: 15px 13px; grid-template-columns: 32px minmax(0, 1fr); }
  .source-identity h3, .source-identity p { white-space: normal; }
  .source-state { grid-column: 2; }
  .source-row .primary-link { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .overview-band { padding: 22px 18px; }
  .overview-actions { grid-template-columns: 1fr; }
  .capability-grid { grid-template-columns: 1fr; }
  .capability-grid article { min-height: 0; padding: 20px 18px; border-right: 0; border-bottom: 1px solid #e2e6ea; }
  .capability-grid article:last-child { border-bottom: 0; }
  .login-panel, .account-panel { padding: 24px 20px; }
}
