:root {
  --primary: #2f6fed;
  --primary-dark: #1f4fc4;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e3e6ec;
  --text: #1a2233;
  --text-muted: #6b7280;
  --danger: #d1364a;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
}

/* Login screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 30, 60, 0.06);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card .brand {
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

.google-btn-wrap {
  display: flex;
  justify-content: center;
}

.error {
  color: var(--danger);
  background: #fdeced;
  border: 1px solid #f6c6cc;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 1.25rem;
  font-size: 0.88rem;
}

/* App shell */
.app-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.4rem 0.9rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  background: #f0f2f6;
}

.content {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  flex-wrap: wrap;
}

.crumb {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.92rem;
  padding: 0.15rem 0;
}

.crumb:hover {
  text-decoration: underline;
}

.crumb.current {
  color: var(--text);
  font-weight: 600;
}

.crumb-sep {
  color: var(--text-muted);
}

/* Search */
.search-wrap {
  position: relative;
  width: 260px;
  max-width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

#search-box {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

#search-box:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

/* File table */
.file-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-table-head {
  display: grid;
  grid-template-columns: 1fr 90px 110px 48px;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

#file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr 90px 110px 48px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}

.file-row:last-child {
  border-bottom: none;
}

.file-row:hover {
  background: #fafbfd;
}

.file-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  min-width: 0;
}

.file-main:hover {
  color: var(--primary);
}

.file-icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.file-icon svg {
  width: 100%;
  height: 100%;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-size,
.col-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.col-action {
  display: flex;
  justify-content: flex-end;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
}

.download-btn:hover {
  background: #eef2fb;
  color: var(--primary);
}

.download-btn svg {
  width: 16px;
  height: 16px;
}

.empty-row {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

#file-list.loading {
  opacity: 0.5;
}

/* Mobile */
@media (max-width: 560px) {
  .file-table-head .col-date,
  .file-row .col-date {
    display: none;
  }
  .file-table-head {
    grid-template-columns: 1fr 70px 40px;
  }
  .file-row {
    grid-template-columns: 1fr 70px 40px;
  }
  .search-wrap {
    width: 100%;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
