:root {
  color-scheme: light;
  --bg: #f7f2ec;
  --panel: #fffaf4;
  --panel-strong: #fffdf8;
  --text: #251f1b;
  --muted: #756b61;
  --line: #ded3c7;
  --accent: #c36a4a;
  --accent-strong: #9f4f35;
  --accent-soft: #f1d7c7;
  --shadow: 0 18px 50px rgba(86, 54, 31, 0.12);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-form button,
.primary-button,
.ghost-button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
}

.ghost-button {
  background: transparent;
  color: var(--accent-strong);
}

.ghost-button:hover,
.primary-button:hover,
.login-form button:hover {
  border-color: var(--accent-strong);
}

.error-text {
  min-height: 20px;
  margin: 0;
  color: #a5392d;
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto 18px;
}

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

.quota-info {
  align-self: center;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.breadcrumbs {
  max-width: 1280px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
}

.breadcrumbs button {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  padding: 6px 8px;
}

.breadcrumbs button:hover {
  background: var(--accent-soft);
}

.task-panel {
  max-width: 1280px;
  margin: 0 auto 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selection-bar {
  max-width: 1280px;
  margin: 0 auto 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.selection-actions button:disabled {
  cursor: default;
  opacity: 0.48;
}

.task-panel-head,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-panel h2,
.modal h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.text-button,
.icon-button,
.danger-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-strong);
  padding: 8px 10px;
}

.text-button:hover,
.icon-button:hover {
  background: var(--accent-soft);
}

.task-rows {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.task-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.task-progress {
  height: 7px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eaded2;
}

.task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.task-row.error .task-progress span {
  background: #b94a3a;
}

.danger-button {
  color: #a5392d;
  border: 1px solid #d7b1a8;
  background: transparent;
  padding: 10px 14px;
  font-weight: 700;
}

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

.content {
  max-width: 1280px;
  margin: 0 auto;
}

.table-wrap {
  position: relative;
  overflow: auto;
  min-height: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #efe3d8;
  color: #5f5046;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  font-size: 14px;
}

.select-col {
  width: 46px;
  min-width: 46px;
  text-align: center;
}

.select-col input {
  width: 17px;
  height: 17px;
  padding: 0;
}

tr[data-kind="Folder"] {
  cursor: pointer;
}

tbody tr:hover {
  background: #fff4e9;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.file-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  flex: 0 0 auto;
  font-size: 17px;
  line-height: 1;
}

.file-icon.folder {
  background: #e8dfc8;
  color: #826322;
}

.file-icon.video {
  background: #dbe6e0;
  color: #3d7159;
}

.file-icon.regular {
  background: #eaded7;
  color: #8b5544;
}

.name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

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

.empty-state,
.loading-state {
  position: absolute;
  inset: 74px 0 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.context-menu {
  position: fixed;
  z-index: 20;
  min-width: 170px;
  padding: 6px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.menu-group {
  padding: 4px 0;
}

.menu-group + .menu-group {
  border-top: 1px solid var(--line);
}

.context-menu button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.menu-icon-button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-icon-button img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.context-menu button:hover {
  background: var(--accent-soft);
}

.danger-menu-button {
  color: #a5392d !important;
}

.danger-menu-button:hover {
  background: #f4d8d2 !important;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #2f2924;
  color: #fffaf4;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(37, 31, 27, 0.32);
}

.modal {
  width: min(560px, 100%);
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-subtitle {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--text);
  padding: 12px;
  outline: none;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.modal-breadcrumbs {
  margin: 12px 0;
}

.folder-picker {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.folder-option {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.folder-option:hover {
  background: var(--accent-soft);
}

.folder-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .ghost-button {
    flex: 1;
  }

  .quota-info {
    order: -1;
    width: 100%;
    max-width: none;
  }

  .selection-bar,
  .selection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .task-row {
    grid-template-columns: 1fr;
  }
}
