:root {
  --bg: #eef3f9;
  --bg-accent: #dbe8f6;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --surface-soft: #f6f9fd;
  --text: #1d2733;
  --muted: #607286;
  --line: rgba(96, 114, 134, 0.18);
  --line-strong: rgba(96, 114, 134, 0.3);
  --primary: #0b57d0;
  --primary-dark: #0842a0;
  --primary-soft: rgba(11, 87, 208, 0.1);
  --success: #188038;
  --success-soft: rgba(24, 128, 56, 0.12);
  --danger: #c5221f;
  --danger-soft: rgba(197, 34, 31, 0.12);
  --warning: #b06000;
  --shadow: 0 18px 48px rgba(21, 45, 78, 0.12);
  --radius: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(87, 154, 255, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(37, 211, 102, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 36%, #f9fbff 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.5 "Segoe UI Variable Text", "Segoe UI", "Arial", sans-serif;
  background: transparent;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

code,
pre {
  font-family: "Cascadia Code", "Consolas", monospace;
}

.wrapper {
  width: min(1200px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(100%, 480px);
}

.hero {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(232, 240, 254, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero h1,
.hero h2,
.page-header h1,
.page-header h2,
.card h2,
.card h3 {
  margin: 0;
}

.hero p,
.page-header p,
.card p {
  margin: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(236, 242, 252, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.page-header-copy {
  display: grid;
  gap: 0.35rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-subtitle {
  color: var(--muted);
  max-width: 62ch;
}

.nav-pills,
.top-actions,
.actions,
.button-row,
.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav-pills a,
.pill-link,
.sort-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(14, 30, 50, 0.08);
}

.nav-pills a.active,
.pill-link.active,
.sort-chip.active {
  background: var(--primary);
  color: #fff;
}

.nav-pills a:hover,
.pill-link:hover,
.sort-chip:hover {
  text-decoration: none;
  border-color: rgba(11, 87, 208, 0.2);
}

.card {
  margin-bottom: 1rem;
  padding: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-header-copy {
  display: grid;
  gap: 0.25rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
}

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

.surface-soft {
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.88), rgba(255, 255, 255, 0.7));
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.list {
  display: grid;
  gap: 0.85rem;
}

.stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  margin-top: 0.35rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.item,
.list-card,
.file-card,
.month-card,
.day-card,
.tenant-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
}

.item,
.list-card,
.month-card,
.day-card {
  padding: 1rem;
}

.month-grid,
.day-grid,
.file-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.file-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.month-card a,
.day-card a,
.tenant-summary-name {
  font-size: 1.05rem;
  font-weight: 700;
}

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

.meta-row,
.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.status-chip.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(24, 128, 56, 0.16);
}

.status-chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(197, 34, 31, 0.16);
}

.status-chip.warn {
  background: rgba(176, 96, 0, 0.12);
  color: var(--warning);
  border-color: rgba(176, 96, 0, 0.16);
}

.alert {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.alert.ok {
  background: var(--success-soft);
  border-color: rgba(24, 128, 56, 0.14);
  color: var(--success);
}

.alert.error {
  background: var(--danger-soft);
  border-color: rgba(197, 34, 31, 0.14);
  color: var(--danger);
}

form {
  display: grid;
  gap: 0.95rem;
}

.form-grid {
  display: grid;
  gap: 0.95rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label,
.fieldset-label {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(11, 87, 208, 0.55);
  box-shadow: 0 0 0 4px rgba(11, 87, 208, 0.12);
}

button,
.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0.8rem 1.1rem;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(11, 87, 208, 0.25);
}

button:hover,
.button:hover,
a.button:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

button.secondary,
.button.secondary,
a.button.secondary {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.secondary:hover,
.button.secondary:hover,
a.button.secondary:hover {
  background: rgba(255, 255, 255, 1);
}

button.danger,
.button.danger,
a.button.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 26px rgba(197, 34, 31, 0.22);
}

.inline-form {
  display: inline;
}

.inline-form button,
.inline-form .button {
  min-height: 40px;
}

.preview {
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 20px;
  background: linear-gradient(180deg, #f9fbff, #eef4fb);
  border: 1px solid var(--line);
}

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 0.75rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(236, 242, 252, 0.92));
  border: 1px solid var(--line);
}

.token-box {
  margin: 0;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(232, 240, 254, 0.9), rgba(255, 255, 255, 0.9));
  color: var(--primary-dark);
  white-space: pre-wrap;
  word-break: break-word;
}

.qr-wrap {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 1rem;
  border-radius: 24px;
  border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(236, 242, 252, 0.84));
}

.qr-image {
  width: min(100%, 320px);
  height: auto;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.8);
}

.table th,
.table td {
  padding: 0.85rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table thead th {
  background: rgba(232, 240, 254, 0.72);
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table code {
  white-space: pre-wrap;
  word-break: break-word;
}

.status-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.status-dot.ok {
  background: #34a853;
  box-shadow: 0 0 0 6px rgba(52, 168, 83, 0.14);
}

.status-dot.bad {
  background: #ea4335;
  box-shadow: 0 0 0 6px rgba(234, 67, 53, 0.14);
}

.status-dot.warn {
  background: #fbbc04;
  box-shadow: 0 0 0 6px rgba(251, 188, 4, 0.14);
}

.tenant-list {
  display: grid;
  gap: 0.9rem;
}

.tenant-row {
  overflow: hidden;
}

.tenant-row summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1.1rem;
  cursor: pointer;
}

.tenant-row summary::-webkit-details-marker {
  display: none;
}

.tenant-summary-copy {
  display: grid;
  gap: 0.15rem;
}

.tenant-summary-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.tenant-panel {
  padding: 0 1.1rem 1.1rem;
  display: grid;
  gap: 0.9rem;
}

.split-card {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

.panel-stack {
  display: grid;
  gap: 0.9rem;
}

.file-card {
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.file-card-header {
  display: grid;
  gap: 0.4rem;
}

.file-name {
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.empty-state {
  padding: 1.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.dialog {
  width: min(100%, 560px);
  border: 0;
  padding: 0;
  border-radius: 28px;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(14, 26, 45, 0.45);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 1.25rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(21, 45, 78, 0.24);
}

.dialog-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dialog-subtitle {
  color: var(--muted);
  margin-bottom: 1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.mobile-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.spaced {
  display: grid;
  gap: 1rem;
}

@media (max-width: 960px) {
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2,
  .split-card,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .wrapper {
    width: min(100% - 1rem, 1000px);
  }
}

@media (max-width: 680px) {
  .wrapper {
    width: min(100% - 0.75rem, 1000px);
    padding-top: 0.75rem;
    padding-bottom: 1.2rem;
  }

  .page-header,
  .card,
  .hero {
    padding: 1rem;
    border-radius: 24px;
  }

  .page-header {
    gap: 0.9rem;
  }

  .page-header,
  .card-header,
  .tenant-row summary {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions,
  .nav-pills,
  .actions,
  .button-row,
  .filters,
  .file-actions,
  .dialog-actions {
    width: 100%;
  }

  .nav-pills a,
  .pill-link,
  .sort-chip,
  .button,
  button,
  .inline-form button {
    width: 100%;
  }

  .table {
    min-width: 560px;
  }

  .preview-frame {
    min-height: 220px;
  }

  .dialog {
    width: calc(100% - 1rem);
  }
}
