:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #d9dde5;
  --text: #18202f;
  --muted: #687386;
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --danger: #d9363e;
  --shadow: 0 18px 45px rgba(35, 45, 65, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-box {
  display: grid;
  width: min(360px, 100%);
  gap: 14px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(35, 45, 65, 0.06);
}

.login-box h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: 0;
}

.login-box input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 16px;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-title {
  position: absolute;
  left: 50%;
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
  transform: translateX(-50%);
}

.login-box button,
.action-button,
.add-button {
  min-width: 92px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--primary);
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}

.login-box button:hover,
.add-button:hover {
  background: var(--primary-dark);
}

.login-box button:disabled,
.action-button:disabled,
.add-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.action-button {
  color: var(--text);
  background: #eef2f7;
}

.action-button:hover {
  background: #e3e8f0;
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.danger-button:hover {
  background: #b9252d;
}

.shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 28px auto;
}

.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(35, 45, 65, 0.06);
}

.table-head,
.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 120px;
  gap: 18px;
  align-items: center;
}

.table-head {
  min-height: 46px;
  padding: 0 18px;
  color: var(--muted);
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}

.file-row {
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid #eef1f5;
  font-size: 15px;
  cursor: default;
  user-select: none;
}

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

.file-row:hover,
.file-row.active {
  background: #f3f8ff;
}

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

.muted {
  color: var(--muted);
}

.empty-state {
  display: none;
  padding: 54px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state.show {
  display: block;
}

.context-menu {
  position: fixed;
  z-index: 20;
  display: none;
  min-width: 136px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.context-menu.show {
  display: grid;
  gap: 2px;
}

.context-menu button {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover {
  background: #f2f5fa;
}

.context-menu .danger {
  color: var(--danger);
}

@media (max-width: 720px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 76px;
    gap: 8px;
    padding: 8px 14px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    order: 2;
  }

  .topbar-title {
    position: static;
    order: 1;
    text-align: center;
    transform: none;
  }

  .add-button,
  .action-button {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
    font-size: 14px;
  }

  .shell {
    width: calc(100vw - 20px);
    margin: 16px auto;
  }

  .table-head {
    display: none;
  }

  .file-row {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
    padding: 14px;
  }
}
