:root {
  color-scheme: light;
  --paper: #f3efe6;
  --paper-2: #e8e1d2;
  --ink: #1c1914;
  --ink-soft: #5b5448;
  --rule: #d6cbb6;
  --surface: #fffdf8;
  --surface-2: #faf6ee;
  --accent: #9a3f12;
  --danger: #8a1f1f;
  --danger-bg: #f8e6e4;
  --excel: #1f6b45;
  --word: #1f4a7a;
  --pdf: #8f2218;
  --shadow: 0 18px 50px rgba(40, 28, 12, 0.1);
  --sans: "Segoe UI", "SF Pro Text", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff8ea 0%, transparent 55%),
    radial-gradient(900px 420px at 110% 0%, #efe4d0 0%, transparent 50%),
    var(--paper);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

/*
  Syncfusion ej2-base license banner (validate-lic.js).
  Current build appends an unclassed fixed div with .license-banner-close
  and a claim-license-key link. Older themes used .e-license / .e-license-banner.
*/
body > div:has(> .license-banner-close),
body > div:has(a[href*="utm_source=es_license_validation_banner"]),
body > div:has(a[href*="claim-license-key"]),
.e-license,
.e-license-banner,
.license-banner-close {
  display: none !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.app-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell-home {
  overflow: auto;
}

.topbar-home {
  display: flex;
  align-items: center;
  padding: 14px 22px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 28px 32px;
  min-height: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 20px;
  width: min(1280px, 100%);
  margin: 0 auto;
  flex: 1;
  align-content: stretch;
  min-height: min(64vh, 620px);
  max-height: 720px;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 24px;
  padding: 28px 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  min-height: 0;
  color: inherit;
}

.home-card:hover,
.home-card:focus-visible,
.drop-card.dragover {
  border-color: color-mix(in srgb, var(--ink) 28%, var(--rule));
  background: var(--surface-2);
  outline: none;
  transform: translateY(-1px);
}

.home-card.word:hover { border-color: color-mix(in srgb, var(--word) 45%, var(--rule)); }
.home-card.excel:hover { border-color: color-mix(in srgb, var(--excel) 45%, var(--rule)); }
.home-card.pdf:hover { border-color: color-mix(in srgb, var(--pdf) 45%, var(--rule)); }

.home-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
}

.home-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.home-card strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.home-card small {
  color: var(--ink-soft);
  font-size: 14px;
}

.drop-card {
  border-style: dashed;
  border-width: 1.5px;
}

.drop-card .choose {
  margin-top: 10px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.home-samples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  max-width: 240px;
}

.home-samples button {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

.home-samples button:hover {
  color: var(--ink);
}

.banner {
  width: min(1280px, 100%);
  margin: 16px auto 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 20%, white);
}

.viewer-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #d7d2c8;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  flex: 0 0 auto;
}

.back {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.file-meta {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.file-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  color: var(--ink-soft);
  font-size: 12px;
}

.viewer-host {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #d7d2c8;
}

.viewer-host > #document-editor,
.viewer-host > #spreadsheet,
.viewer-host > #pdf-viewer,
.viewer-host .e-spreadsheet,
.viewer-host .e-de-ctn,
.viewer-host .e-documenteditor,
.viewer-host .e-pdfviewer,
.viewer-host .e-pv-viewer-container {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

.loading,
.empty-viewer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  padding: 24px;
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  border-top-color: var(--ink);
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden-input {
  display: none;
}

@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    max-height: none;
  }

  .home-card {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  body {
    overflow: auto;
  }

  html,
  body,
  #app {
    height: auto;
    max-height: none;
    min-height: 100dvh;
  }

  .home-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .home-card {
    min-height: 220px;
  }
}
