:root {
  --ink: #132330;
  --muted: #697984;
  --line: #d9e3e7;
  --panel: #ffffff;
  --page: #eef4f6;
  --brand: #0d465c;
  --brand-strong: #083244;
  --accent: #f3c13a;
  --danger: #b42318;
  --ok: #207a45;
  --soft: #f7fafb;
  color-scheme: light;
}

body[data-skin="onedrive"] {
  --ink: #eef6ff;
  --muted: #a8b7c8;
  --line: #273446;
  --panel: #0f1722;
  --page: #05070b;
  --brand: #3b82f6;
  --brand-strong: #2563eb;
  --accent: #60a5fa;
  --danger: #f87171;
  --ok: #34d399;
  --soft: #111b2a;
  color-scheme: dark;
}

body[data-skin="executive"] {
  --ink: #1f252b;
  --muted: #69717a;
  --line: #d7d2c8;
  --panel: #fffdf8;
  --page: #eeebe3;
  --brand: #26323d;
  --brand-strong: #111820;
  --accent: #c69b3a;
  --danger: #a53b2d;
  --ok: #36745a;
  --soft: #f7f3eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(135deg, rgba(13, 70, 92, 0.12), rgba(243, 193, 58, 0.1) 36%, rgba(238, 244, 246, 0) 62%),
    var(--page);
  color: var(--ink);
}

body:has(#login-view:not([hidden])) {
  background:
    radial-gradient(circle at 20% 20%, rgba(231, 28, 47, 0.12), transparent 28%),
    radial-gradient(circle at 82% 72%, rgba(11, 17, 24, 0.1), transparent 30%),
    linear-gradient(135deg, #fff 0%, #f7f5f0 48%, #eef5f7 100%);
}

body[data-skin="onedrive"] {
  background:
    linear-gradient(145deg, rgba(59, 130, 246, 0.18), rgba(15, 23, 34, 0.94) 42%, rgba(5, 7, 11, 1) 100%),
    var(--page);
}

body[data-skin="executive"] {
  background:
    linear-gradient(135deg, rgba(198, 155, 58, 0.16), rgba(38, 50, 61, 0.08) 42%, rgba(238, 235, 227, 0) 68%),
    var(--page);
}

button,
input,
select {
  font: inherit;
}

body[data-skin="onedrive"] input,
body[data-skin="onedrive"] select {
  background: #0b111b;
  color: var(--ink);
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  padding: 0 18px;
  box-shadow: 0 8px 18px rgba(13, 70, 92, 0.12);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
  touch-action: manipulation;
}

button:active,
.document-actions a:active,
.select-item:active {
  transform: scale(0.97);
}

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

.ghost-button {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--line);
  box-shadow: none;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.login-view {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.55fr);
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 7vw, 82px);
}

.brand-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
}

.brand-animation {
  width: min(560px, 52vw);
  height: auto;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 24px 45px rgba(14, 20, 26, 0.12));
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.1rem, 7vw, 4.7rem);
  line-height: 0.98;
  max-width: 650px;
}

h2 {
  font-size: 1.35rem;
}

.lead {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.auth-form,
.documents-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(16, 36, 48, 0.1);
}

.auth-form {
  display: grid;
  gap: 18px;
  width: min(100%, 320px);
  padding: 26px;
  justify-self: center;
  border-color: rgba(17, 30, 40, 0.12);
  box-shadow: 0 22px 60px rgba(15, 25, 33, 0.14);
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  justify-content: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.compact-check {
  align-self: end;
  min-height: 48px;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(244, 197, 66, 0.55);
  outline-offset: 2px;
}

.error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 22px;
}

.dashboard-view {
  min-height: calc(100vh - 36px);
}

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

.brand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-inline img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 8px 16px rgba(13, 70, 92, 0.2));
}

.brand-inline span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.documents-panel {
  padding: 20px;
}

.command-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.new-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.new-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.tool-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.tool-group-search {
  grid-column: 1 / -1;
}

.tool-title {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.folder-form,
.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 0;
}

.upload-form {
  padding-top: 0;
  border-top: 0;
}

.file-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  overflow: hidden;
  cursor: pointer;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker span {
  display: inline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.upload-progress div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe7ec;
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 0.18s ease;
}

.upload-progress strong {
  color: var(--brand);
  font-size: 0.8rem;
}

.status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--ok);
  font-weight: 700;
}

.action-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid #f0b8b2;
  border-radius: 8px;
  background: #fff5f4;
  color: var(--danger);
  font-weight: 800;
}

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

.search-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 135px 115px auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.search-form input,
.search-form select {
  min-height: 42px;
}

.search-form button {
  min-height: 42px;
}

.sort-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.sort-bar select {
  min-height: 40px;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.fab-button {
  display: none;
}

#new-button,
.fab-button {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#new-button.is-open {
  background: #365ac5;
}

.fab-button.is-open {
  transform: rotate(45deg) scale(1.03);
  background: #263d91;
}

@keyframes fab-pop {
  0% {
    transform: scale(0.82);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes menu-rise {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fab-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(54, 90, 197, 0.35), 0 18px 40px rgba(54, 90, 197, 0.38);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(54, 90, 197, 0), 0 18px 40px rgba(54, 90, 197, 0.38);
  }
}

.search-field input {
  padding-left: 14px;
}

.search-status {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 800;
}

.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #cfe0e8;
  border-radius: 8px;
  background: #eef7fb;
  color: var(--brand);
}

.selection-bar[draggable="true"] {
  cursor: grab;
}

.selection-bar[draggable="true"]:active {
  cursor: grabbing;
}

.selection-bar strong {
  white-space: nowrap;
}

.selection-drag-hint {
  flex: 1 1 auto;
  min-width: 130px;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.9rem;
}

.selection-bar button {
  min-height: 36px;
}

.search-crumb {
  color: var(--brand);
  font-weight: 900;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  margin: -4px 0 14px;
  overflow-x: auto;
  white-space: nowrap;
}

.current-folder-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 14px;
  padding: 10px;
  border: 1px solid #cfe0e8;
  border-radius: 8px;
  background: #f8fbfc;
}

.current-folder-actions strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-folder-actions div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.current-folder-actions button {
  min-height: 34px;
}

.crumb-button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  background: #eef4f7;
  color: var(--brand);
  border: 1px solid #d5e2e8;
  font-size: 0.92rem;
}

.crumb-separator {
  color: var(--muted);
  font-weight: 800;
}

.folders-list,
.documents-list {
  display: grid;
  gap: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.folders-list {
  margin-bottom: 0;
  border-top: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
}

.documents-list {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.folders-list:empty {
  display: none;
}

.folders-list:empty + .documents-list {
  border-top: 1px solid var(--line);
  border-radius: 8px;
}

.list-header {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 190px 230px;
  gap: 12px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.list-header span:first-child {
  grid-column: 2;
  padding-left: 58px;
}

.folder-row,
.document-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.select-item {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
  justify-self: center;
}

.folder-row:hover,
.document-row:hover {
  border-color: var(--line);
  background: #f4f8fa;
  box-shadow: none;
}

.document-row[draggable="true"] {
  cursor: grab;
}

.document-row[draggable="true"]:active {
  cursor: grabbing;
}

.folder-row {
  grid-template-columns: 28px minmax(0, 1fr);
}

.folder-open {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 46px;
  gap: 14px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.folder-open:hover,
.folder-open:active,
.folder-open:focus {
  background: rgba(13, 70, 92, 0.08);
  color: var(--ink);
}

.folder-details,
.document-details {
  display: grid;
  min-width: 0;
}

.folder-name,
.folder-meta,
.document-name,
.document-meta {
  min-width: 0;
}

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

.folder-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.folder-icon {
  width: 34px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: var(--accent);
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

.folder-icon::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 0;
  width: 18px;
  height: 9px;
  border-radius: 4px 4px 0 0;
  background: #e3b52e;
}

.document-name {
  overflow-wrap: anywhere;
  font-weight: 800;
  font-size: 1rem;
}

.document-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.document-actions {
  display: flex;
  gap: 8px;
}

.document-row {
  grid-template-columns: 28px 44px minmax(0, 1fr) auto;
  min-height: 66px;
}

.document-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #c9d4da;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #f0f3f5);
  color: #d11b2d;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: none;
  position: relative;
}

.document-thumb::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 11px;
  height: 2px;
  background: #9aa8af;
  box-shadow: 0 -7px 0 #9aa8af, 0 -14px 0 #9aa8af;
}

.document-thumb:disabled {
  opacity: 1;
  cursor: default;
}

.document-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.document-thumb img + * ,
.document-thumb:has(img)::after {
  display: none;
}

.document-details {
  min-width: 0;
}

.document-actions a,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  padding: 0 11px;
  text-decoration: none;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.document-actions {
  opacity: 0.95;
  min-width: 380px;
  justify-content: flex-end;
}

.folder-actions {
  min-width: 260px;
}

.document-actions a,
.secondary-button {
  background: #eef5f8;
  color: var(--brand);
  border: 1px solid #cfe0e8;
}

.document-actions a:hover,
.secondary-button:hover,
button:hover {
  background: var(--brand-strong);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(13, 70, 92, 0.16);
}

.ghost-button:hover,
.danger-button:hover {
  background: #f8fbfc;
}

.secondary-button {
  border: 1px solid var(--brand);
}

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

.empty-state {
  margin: 10px 0 0;
  color: var(--muted);
}

.preview-dialog,
.settings-dialog,
.item-dialog {
  width: min(1040px, calc(100vw - 28px));
  height: min(840px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(16, 36, 48, 0.25);
}

.settings-dialog {
  height: auto;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.item-dialog {
  width: min(720px, calc(100vw - 28px));
  height: auto;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.preview-dialog::backdrop,
.settings-dialog::backdrop,
.item-dialog::backdrop {
  background: rgba(14, 58, 83, 0.45);
}

.preview-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.preview-controls button {
  min-height: 34px;
}

.item-dialog-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.details-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.details-list div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.details-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.details-list dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.preview-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-header h2 {
  margin-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 16px;
  padding: 16px;
}

.settings-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
}

.settings-section-wide {
  grid-column: 1 / -1;
}

.settings-section h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.settings-stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.settings-stats.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-stats div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.settings-stats dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.settings-stats dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.password-form,
.user-form {
  display: grid;
  gap: 12px;
}

.user-form {
  grid-template-columns: 1fr 1fr 160px auto;
  align-items: end;
}

.users-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trash-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.trash-row div {
  display: grid;
  min-width: 0;
}

.trash-row strong,
.trash-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.user-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-row-header,
.user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-row-header strong,
.user-row-header span {
  display: block;
}

.user-row-header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.user-row-header select {
  width: 150px;
}

.folder-access-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.access-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding-left: calc(var(--depth, 0) * 16px);
  color: var(--ink);
  font-weight: 700;
}

.access-option input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}

.settings-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.skin-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.skin-option {
  display: grid;
  justify-items: start;
  gap: 6px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.skin-option.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 70, 92, 0.12);
}

.skin-option small {
  color: var(--muted);
  font-weight: 700;
}

.skin-swatch {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.transmen-swatch {
  background: linear-gradient(90deg, #0d465c 0 45%, #f3c13a 45% 68%, #eef4f6 68%);
}

.onedrive-swatch {
  background: linear-gradient(90deg, #05070b 0 38%, #3b82f6 38% 68%, #0f1722 68%);
}

.executive-swatch {
  background: linear-gradient(90deg, #26323d 0 42%, #c69b3a 42% 64%, #fffdf8 64%);
}

.update-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.update-box p {
  margin: 5px 0 0;
  color: var(--muted);
}

.update-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100% - 64px);
  overflow: hidden;
  background: #eef2f5;
  overscroll-behavior: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-overflow-scrolling: auto;
}

.preview-body.is-pdf-preview {
  align-items: stretch;
  justify-content: flex-start;
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

.preview-body img,
.preview-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  border: 0;
  transform-origin: center center;
  transition: transform 0.16s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.preview-pdf-frame {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fff;
}

.preview-body img {
  object-fit: contain;
  padding: 12px;
}

.preview-pdf {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border: 0;
  background: #fff;
  pointer-events: auto;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .app-shell {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .login-view,
  .workspace {
    grid-template-columns: 1fr;
  }

  .login-view {
    align-content: center;
    justify-items: center;
    min-height: calc(100svh - 16px);
    gap: 22px;
  }

  .brand-panel {
    align-items: center;
    flex-direction: column;
  }

  .brand-logo {
    width: 76px;
    height: 76px;
  }

  .brand-animation {
    width: min(390px, 92vw);
    height: auto;
    max-height: 240px;
  }

  .auth-form {
    width: min(100%, 390px);
    padding: 22px;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .documents-panel {
    width: 100%;
    padding: 10px;
    padding-bottom: 92px;
    overflow: hidden;
  }

  .panel-heading {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
  }

  .panel-heading h2 {
    font-size: 1.25rem;
  }

  .panel-heading .ghost-button {
    min-height: 38px;
    padding: 0 12px;
  }

  #new-button {
    display: none;
  }

  .new-menu {
    grid-template-columns: 1fr;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 92px;
    z-index: 20;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 36, 48, 0.28);
    animation: menu-rise 0.2s ease-out;
  }

  .tool-group,
  .new-card {
    gap: 6px;
    padding: 8px;
    border: 1px solid #dce6eb;
    border-radius: 8px;
    background: #fff;
  }

  .tool-title {
    font-size: 0.72rem;
  }

  .folder-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .upload-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .search-form {
    position: static;
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 8px;
    align-items: center;
    margin: 10px 0 12px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbfc;
    box-shadow: none;
  }

  #search-input {
    grid-column: 1;
    min-height: 38px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 0.92rem;
  }

  #search-input::placeholder {
    color: #87949c;
  }

  .search-form button[type="submit"] {
    grid-column: 2;
    min-height: 38px;
    border-radius: 8px;
    background: var(--brand);
  }

  #date-filter {
    grid-column: 1;
    grid-row: 2;
    display: block;
    min-height: 38px;
  }

  #format-filter {
    grid-column: 2;
    grid-row: 2;
    display: block;
    min-height: 38px;
  }

  .search-form .ghost-button {
    display: block;
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 36px;
  }

  .sort-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 12px;
  }

  .sort-bar select {
    width: 100%;
    min-width: 0;
  }

  .search-form select {
    min-width: 0;
  }

  .settings-grid,
  .settings-stats.compact,
  .user-form,
  .folder-access-list,
  .skin-picker,
  .update-box {
    grid-template-columns: 1fr;
  }

  .update-box {
    display: grid;
  }

  .update-actions {
    display: grid;
  }

  .selection-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .selection-drag-hint {
    display: none;
  }

  .current-folder-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .current-folder-actions div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  input,
  select,
  button,
  .file-picker {
    min-height: 38px;
    font-size: 0.9rem;
  }

  button {
    padding: 0 10px;
  }

  .list-header {
    display: none;
  }

  .folder-row,
  .document-row {
    grid-template-columns: 24px minmax(0, 1fr);
    min-height: 60px;
    padding: 8px 10px;
    gap: 8px;
  }

  .document-row {
    grid-template-columns: 24px 40px minmax(0, 1fr);
  }

  .document-thumb {
    width: 38px;
    height: 46px;
    min-height: 46px;
  }

  .document-actions {
    display: flex;
    grid-column: 3;
    min-width: 0;
    overflow-x: auto;
    padding-top: 4px;
  }

  .folder-actions {
    grid-column: 2;
    min-width: 0;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .rename-form,
  .details-list {
    grid-template-columns: 1fr;
  }

  .fab-button {
    display: grid;
    place-items: center;
    position: fixed;
    right: 18px;
    bottom: 24px;
    z-index: 30;
    width: 64px;
    height: 64px;
    min-height: 64px;
    border-radius: 999px;
    background: #365ac5;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    box-shadow: 0 18px 40px rgba(54, 90, 197, 0.38);
    animation: fab-pop 0.22s ease-out, fab-ring 1.7s ease-out infinite;
  }

  .fab-button.is-open {
    animation: none;
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: 2.35rem;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    padding-bottom: 12px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .brand-inline strong {
    display: none;
  }

  .brand-inline span {
    display: none;
  }

  .brand-inline img {
    width: 42px;
    height: 42px;
  }

  .panel-heading {
    align-items: center;
  }

  .folder-form {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .upload-form {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  #date-filter {
    grid-column: 1;
  }

  #format-filter {
    grid-column: 2;
  }

  .search-form .ghost-button {
    min-height: 36px;
  }

  .document-actions {
    gap: 6px;
    justify-content: flex-start;
  }

  .folder-row {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
  }

  .folder-actions {
    grid-column: 2;
    justify-content: flex-start;
    padding-left: 0;
    overflow-x: auto;
  }

  .folder-row .danger-button,
  .folder-row .secondary-button {
    width: auto;
    flex: 0 0 auto;
  }

  .document-row {
    grid-template-columns: 24px 38px minmax(0, 1fr);
    gap: 10px;
  }

  .document-thumb {
    width: 36px;
    height: 44px;
    min-height: 44px;
    font-size: 0.7rem;
  }

  .document-name,
  .folder-name {
    font-size: 0.98rem;
  }

  .document-meta,
  .folder-meta {
    font-size: 0.82rem;
  }

  .document-actions a,
  .secondary-button,
  .danger-button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .preview-dialog,
  .settings-dialog,
  .item-dialog {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .preview-header,
  .dialog-header {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-header {
    min-height: 96px;
  }

  .preview-header strong {
    font-size: 1rem;
    line-height: 1.25;
  }

  .preview-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .section-heading-row,
  .trash-row {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-body {
    height: calc(100% - 96px);
  }

  .preview-body.is-pdf-preview {
    overflow: auto;
    touch-action: pan-x pan-y pinch-zoom;
  }

  .preview-pdf {
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
  }
}
