:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1a1d21;
  --text-muted: #5b6470;
  --border: #d9dde3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --surface-2: #23272f;
    --text: #e6e8eb;
    --text-muted: #9aa3ad;
    --border: #2f343d;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

header.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

header.app-header .logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  border-color: transparent;
}

.field {
  margin-bottom: 16px;
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.row .field {
  flex: 1 1 160px;
}

.password-row {
  align-items: flex-end;
}

.password-row .password-field {
  flex: 1 1 200px;
  margin-bottom: 0;
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 16px;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
}

.dropzone strong {
  color: var(--text);
}

/* Buttons */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 600;
}

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

button.primary:hover {
  background: var(--primary-hover);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

button.danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

button.small {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

/* Progress list */
.upload-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.upload-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.upload-list li:last-child {
  border-bottom: none;
}

.upload-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.upload-item-name {
  font-weight: 600;
  word-break: break-all;
}

.upload-item-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.15s ease;
}

.upload-item-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-item-status .ok {
  color: var(--success);
}

.upload-item-status .err {
  color: var(--danger);
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  text-decoration: underline;
  font-weight: 500;
  font-size: 0.82rem;
  cursor: pointer;
}

/* My uploads */
.my-uploads .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.my-uploads .item:last-child {
  border-bottom: none;
}

.my-uploads .item .info {
  min-width: 0;
}

.my-uploads .item .name {
  font-weight: 600;
  word-break: break-all;
}

.my-uploads .item .sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

/* Share page */
.share-file {
  text-align: center;
  padding: 8px 0 4px;
}

.share-file .icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.share-file .name {
  font-size: 1.15rem;
  font-weight: 700;
  word-break: break-all;
}

.share-file .meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.password-box {
  margin-top: 16px;
  text-align: left;
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.message.error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.message.info {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

footer.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 32px;
}

/* Header actions (logout) */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Checkbox field (folder creation) */
.checkbox-field {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  padding-bottom: 16px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Folder list (admin) */
.folder-list .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.folder-list .item:last-child {
  border-bottom: none;
}

.folder-list .item .info {
  min-width: 0;
}

.folder-list .item .name {
  font-weight: 600;
  word-break: break-all;
}

.folder-list .item .sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.folder-list .item .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Folder page */
.meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.files-heading {
  margin-top: 24px;
}

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

.file-list .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.file-list .item .info {
  min-width: 0;
}

.file-list .item .name {
  font-weight: 600;
  word-break: break-all;
}

.file-list .item .sub {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.file-list .item .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .container {
    padding: 16px 12px 48px;
  }
  .card {
    padding: 16px;
  }
}
