/* Štáb mobile shell — Linear-clean light/dark */

:root {
  --bg: #FAFBFC;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --border: #E4E6EB;
  --ink: #0E1116;
  --ink-secondary: #5C6370;
  --ink-muted: #8A929E;
  --primary: #1B2A6B;
  --primary-hover: #243A8F;
  --primary-soft: rgba(27, 42, 107, 0.10);
  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --radius-card: 8px;
  --radius-control: 6px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-glow: 0 0 0 1px var(--primary-soft), 0 12px 32px -8px var(--primary-soft);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08090C;
    --surface: #101218;
    --surface-2: #14171F;
    --border: #1F2330;
    --ink: #F2F4F8;
    --ink-secondary: #8B92A1;
    --ink-muted: #5C6370;
    --primary: #4F6BD9;
    --primary-hover: #6B85E8;
    --primary-soft: rgba(79, 107, 217, 0.18);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Switzer', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  height: 100%;
  position: relative;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  padding: calc(40px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Logo */
.logo-section {
  text-align: center;
  margin: 24px 0 40px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--ink);
  color: var(--bg);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  border-radius: var(--radius-card);
  margin-bottom: 16px;
}

.logo-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.logo-subtitle {
  font-size: 14px;
  color: var(--ink-secondary);
  margin-top: 6px;
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.form-hint {
  font-weight: 400;
  color: var(--ink-muted);
  font-size: 12px;
}

.form-group input {
  font-family: inherit;
  font-size: 16px; /* >= 16px aby iOS nerobil zoom */
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.code-input {
  text-align: center;
  font-size: 24px !important;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
}

/* Buttons */
.btn-primary {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-control);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
  -webkit-appearance: none;
  appearance: none;
  margin-top: 8px;
}

.btn-primary:active {
  transform: scale(0.98);
}

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

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

.btn-link {
  font-family: inherit;
  font-size: 14px;
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 8px;
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Form foot */
.form-foot {
  text-align: center;
  margin-top: 8px;
}

.form-foot a {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
}

.form-foot a:hover {
  text-decoration: underline;
}

/* Error */
.error-msg {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-control);
  font-size: 13px;
  display: none;
}

.error-msg:not(:empty) {
  display: block;
}

/* 2FA */
.twofa-section {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.twofa-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  text-align: center;
}

.twofa-desc {
  font-size: 14px;
  color: var(--ink-secondary);
  margin-bottom: 24px;
  text-align: center;
}

/* Tenant picker */
.tenant-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 16px;
}

.tenant-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.tenant-card:active {
  transform: scale(0.98);
}

.tenant-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.tenant-card-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-control);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #FFFFFF;
  overflow: hidden;
}

.tenant-card-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tenant-card-body {
  flex: 1;
  min-width: 0;
}

.tenant-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenant-card-meta {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.tenant-card-arrow {
  flex-shrink: 0;
  color: var(--ink-muted);
  font-size: 20px;
}

.tenant-card.platform .tenant-card-mark {
  background: var(--ink);
  color: var(--bg);
}

/* Loading */
.loading-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--ink-secondary);
  font-size: 14px;
}

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

/* Version */
.version-info {
  position: fixed;
  bottom: calc(8px + var(--safe-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: var(--ink-muted);
  font-size: 11px;
  pointer-events: none;
  z-index: -1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
