/* portal.css — shared stylesheet for portal.squarekeeper.com (Tier 4 portal users)
   Dark theme, sky-blue brand chrome, mobile-first.
   Per TENANT_PORTAL_LOGIN_SPEC_v1.md §5. */

:root {
  --bg: #06060C;
  --surface: #111118;
  --surface-2: #1A1A23;
  --border: #1E293B;
  --text: #E2E8F0;
  --text-faint: #94A3B8;
  --text-dim: #64748B;
  --sk-blue: #11A6F6;
  --sk-blue-light: #60BCFB;
  --sk-blue-dark: #0980BF;
  --sk-blue-darker: #075985;
  --sk-soft: rgba(17, 166, 246, 0.15);
  --sk-button-text: #001423;
  --success: #34D399;
  --warning: #FBBF24;
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--sk-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.portal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.portal-header img { height: 32px; width: 32px; border-radius: 8px; }
.portal-header .sk-wordmark { font-size: 17px; font-weight: 700; color: var(--text); }
.portal-header .portal-header-sub { font-size: 13px; color: var(--text-faint); margin-left: auto; }

.portal-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

h1 { font-size: 24px; font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }

.portal-intro { color: var(--text-faint); margin: 0 0 20px; font-size: 14px; }

/* ── Login + auth pages ─────────────────────────────────────────── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 24px;
  max-width: 420px;
  margin: 60px auto 24px;
}
.auth-card .auth-icon {
  display: block;
  margin: 0 auto 14px;
  width: 56px;
  height: 56px;
  border-radius: 12px;
}
.auth-card h1 { text-align: center; margin: 0 0 6px; font-size: 22px; }
.auth-card .auth-sub { text-align: center; color: var(--text-faint); font-size: 13px; margin: 0 0 24px; }

.auth-field { margin-bottom: 14px; }
.auth-field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-weight: 600;
}
.auth-field input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--sk-blue);
}

.auth-btn {
  width: 100%;
  background: var(--sk-blue);
  color: var(--sk-button-text);
  border: none;
  border-radius: 6px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  font-family: inherit;
}
.auth-btn:hover { background: var(--sk-blue-light); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.auth-btn.secondary:hover { background: var(--surface-2); }

.auth-error, .auth-info {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 12px 0;
  display: none;
}
.auth-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(248,113,113,0.3); }
.auth-info { background: var(--sk-soft); color: var(--sk-blue-light); border: 1px solid rgba(17,166,246,0.3); }
.auth-error.show, .auth-info.show { display: block; }

.auth-meta {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin: 18px 0 0;
}
.auth-meta a { color: var(--text-faint); }

/* ── Dashboard tiles ────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.tile:hover { border-color: var(--sk-blue); text-decoration: none; }
.tile.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.tile-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.tile-title-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sk-blue); }
.tile-desc { font-size: 13px; color: var(--text-faint); margin-bottom: 12px; flex: 1; }
.tile-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-self: flex-start;
}
.tile-status.confirmed { background: rgba(52,211,153,0.15); color: var(--success); }
.tile-status.pending { background: rgba(251,191,36,0.15); color: var(--warning); }
.tile-status.delinquent { background: var(--danger-bg); color: var(--danger); }

/* ── Account / settings ─────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.info-row .value { color: var(--text); font-weight: 500; }

.btn-link {
  background: transparent;
  color: var(--sk-blue);
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.btn-danger:hover { background: var(--danger-bg); }

/* ── Announcements panel + list/detail pages ────────────────────── */
.ann-panel {
  margin-top: 32px;
}
.ann-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.ann-panel-head h2 { margin: 0; font-size: 18px; }
.ann-panel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ann-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
  display: block;
}
.ann-item:hover { border-color: var(--sk-blue); text-decoration: none; }
.ann-item-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.ann-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.ann-item.has-reply { border-color: rgba(17, 166, 246, 0.5); }
.ann-reply-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--sk-soft);
  color: var(--sk-blue-light);
  flex-shrink: 0;
  white-space: nowrap;
}
.ann-item-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ann-item-preview {
  font-size: 13px;
  color: var(--text-faint);
  line-height: 1.45;
}

.ann-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-top: 12px;
}
.ann-detail h1 { margin: 0 0 6px; font-size: 22px; }
.ann-detail .ann-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.ann-detail .ann-body {
  font-size: 15px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.55;
  word-wrap: break-word;
}
.ann-detail .ann-attachments {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.ann-detail .ann-attachments h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.ann-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}
.ann-attachment:hover { border-color: var(--sk-blue); text-decoration: none; }
.ann-attachment-icon {
  width: 24px;
  height: 24px;
  background: var(--sk-soft);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--sk-blue-light);
  flex-shrink: 0;
}
.ann-attachment-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ann-attachment-size {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.ann-back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-faint);
}

.ann-questions {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
}
.ann-questions h2 { margin: 0 0 6px; font-size: 17px; }

.ann-thread {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
  max-height: 340px;
  overflow-y: auto;
}
.ann-thread-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

.ann-msg {
  margin-bottom: 12px;
  max-width: 88%;
}
.ann-msg:last-child { margin-bottom: 0; }
.ann-msg-tenant { margin-right: auto; }
.ann-msg-admin { margin-left: auto; }
.ann-msg-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.ann-msg-admin .ann-msg-meta { text-align: right; }
.ann-msg-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}
.ann-msg-admin .ann-msg-body {
  background: var(--sk-soft);
  border-color: rgba(17, 166, 246, 0.3);
}

.ann-question-form {
  display: flex;
  flex-direction: column;
}
.ann-question-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-weight: 600;
}
.ann-question-form textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 90px;
}
.ann-question-form textarea:focus { outline: none; border-color: var(--sk-blue); }

.ann-question-error {
  display: none;
  font-size: 13px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 10px 0;
}
.ann-question-error.show { display: block; }
.ann-question-error[style*="block"] { display: block; }
.ann-question-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.sug-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.sug-item:last-child { margin-bottom: 0; }
.sug-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sug-item-date { font-size: 11px; color: var(--text-dim); }
.sug-item-body {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.45;
}
.sug-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sug-badge-open { background: rgba(251,191,36,0.15); color: var(--warning); }
.sug-badge-closed { background: rgba(148,163,184,0.15); color: var(--text-faint); }
.sug-cat {
  font-size: 11px;
  color: var(--sk-blue-light);
  margin-left: 6px;
}

.lf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.lf-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lf-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.lf-card-nophoto {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 11px;
}
.lf-card-body { padding: 10px 12px; }
.lf-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.lf-card-loc { font-size: 11px; color: var(--sk-blue-light); margin-bottom: 4px; }
.lf-card-desc {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lf-card-meta { font-size: 10px; color: var(--text-dim); }
.lf-claim-hint {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--sk-soft);
  border: 1px solid rgba(17, 166, 246, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--sk-blue-light);
  text-align: center;
}

.ann-questions-disabled {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.ann-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.portal-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── Loading + denied ───────────────────────────────────────────── */
.fullscreen-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
}
.fullscreen-state img { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 18px; }
.fullscreen-state h1 { margin: 0 0 8px; }
.fullscreen-state p { color: var(--text-faint); margin: 0 0 16px; font-size: 14px; max-width: 360px; }
.fullscreen-state .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--sk-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .auth-card { margin: 24px 16px; padding: 22px 18px; }
  .portal-main { padding: 20px 16px 60px; }
  .tile-grid { grid-template-columns: 1fr; }
}
