:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --radius: 8px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
}

/* Login */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

/* Layout */
.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

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

.toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
}

.page-info {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Forms */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.field small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  font-size: 1rem;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

.checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: #475569;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  background: var(--surface);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.file-table th,
.file-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--surface-2);
}

.file-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.file-table tr:last-child td {
  border-bottom: 0;
}

.file-table .actions {
  text-align: right;
  white-space: nowrap;
  width: 220px;
}

.file-table .actions .btn {
  margin-left: 0.5rem;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 2rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Status messages */
.status {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.status-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.error {
  color: #fca5a5;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.success {
  color: #86efac;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

/* Modal */
.modal {
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  max-width: 640px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.modal-content {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface-2);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

.entry-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--surface-2);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.entry-list li:last-child {
  border-bottom: 0;
}

.entry-list .folder {
  color: var(--primary);
}

.entry-list .size {
  color: var(--muted);
  flex-shrink: 0;
}

/* Suggestions */
.suggestions {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1rem;
}

.suggestions p {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggestion-list button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.suggestion-list button:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* Utility */
.hidden {
  display: none !important;
}
