:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --text: #18211d;
  --muted: #69756f;
  --line: #dbe3df;
  --accent: #0f766e;
  --accent-soft: #dff5f1;
  --danger: #b4233c;
  --danger-soft: #ffe4e8;
  --warn: #b45309;
  --shadow: 0 12px 30px rgba(21, 31, 27, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: default;
  opacity: 0.65;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

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

.login-panel {
  width: min(100%, 360px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form input,
.admin-form input,
.user-row input,
.user-row select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.error-text {
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin-bottom: 0;
  font-size: 23px;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-button,
.toolbar-actions button,
.panel-heading button,
.mini-button,
.crumb {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.drive-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 22px 20px 56px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.status-strip article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-strip article {
  min-height: 72px;
  padding: 13px;
}

.status-strip span,
.panel-heading p {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar-actions,
.breadcrumbs,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumbs {
  min-width: 0;
}

.crumb {
  min-height: 34px;
  padding: 0 11px;
}

.panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.drop-zone {
  min-height: 300px;
}

.drop-zone.dragging {
  background: var(--accent-soft);
}

.file-list {
  display: grid;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 80px 110px 120px minmax(180px, auto);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

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

.file-name {
  justify-self: start;
  max-width: 100%;
  min-height: 34px;
  overflow: hidden;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-type,
.file-size,
.file-updated,
.user-identity span,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.mini-button.danger {
  border-color: #f1b8c2;
  background: var(--danger-soft);
  color: var(--danger);
}

.empty {
  padding: 42px 16px;
  text-align: center;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.4fr) 110px 110px 90px;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkline input {
  width: auto;
  min-height: auto;
}

.checkline.compact {
  justify-content: center;
}

.user-list {
  display: grid;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 90px 130px 110px 70px 70px 70px;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

.user-identity {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.good-text {
  color: var(--accent);
}

.bad-text {
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #f1b8c2;
  color: var(--danger);
}

@media (max-width: 840px) {
  .toolbar,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .file-row,
  .user-row,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }
}
