* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font, Arial, sans-serif);
  color: var(--text, #111827);
  background: var(--bg, transparent);
  height: 100vh;
}

.app-header {
  padding: 16px 20px 8px;
  background: transparent;
  border-bottom: 1px solid transparent;
  text-align: center;
}

.app-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text, #111827);
}

.app-subtitle {
  font-size: 13px;
  color: var(--muted, #6b7280);
  margin-top: 4px;
}
.app-version { margin-left: 6px; opacity: 0.9; font-weight: 600; }

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 140px);
    padding: 24px 16px 80px; /* reserve space for status bar */
}

.hidden { display: none !important; }

.screen {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#vaultOpsScreen {
  padding-bottom: 90px;
}

.ops-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: rgba(255,255,255,0.92);
  color: #111827 !important;
}

.ops-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  color: #111827 !important;
}

.ops-table th,
.ops-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
  font-size: 14px;
  color: #111827 !important;
}

.ops-table th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
  text-align: left;
  font-weight: 800;
  color: #111827;
}

.ops-table tr:nth-child(even) td {
  background: rgba(249,250,251,0.6);
}

.ops-table .ops-actions {
  white-space: nowrap;
}

.ops-table .ops-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827 !important;
  font-weight: 700;
  cursor: pointer;
  margin-right: 6px;
}

@media (min-width: 900px) {
  .vs-stack {
    max-width: 1100px;
  }
  .screen {
    max-width: 1100px;
  }
}

.ops-table .ops-btn:hover {
  background: #f3f4f6;
}

.ops-table .ops-btn-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.ops-table .ops-btn-primary:hover {
  background: #1d4ed8;
}

.ops-table .ops-btn-danger {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.ops-table .ops-btn-danger:hover {
  background: #991b1b;
}

.vs-authbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px;
}

.home-links {
  margin-top: 8px;
}

.link-button {
  background: transparent;
  border: none;
  color: #2563eb;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.settings-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #111827);
}

.settings-section {
  width: 100%;
  background: var(--surface, rgba(255,255,255,0.92));
  border: 1px solid var(--border, #e5e7eb);
  border-radius: var(--radius-card, 10px);
  box-shadow: var(--shadow-1, none);
  padding: var(--space-2, 12px);
}

.settings-subtitle {
  font-weight: 700;
  color: var(--text, #111827);
  margin-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-row label {
  font-weight: 700;
  color: var(--text, #111827);
}

.settings-row select {
  padding: 10px 12px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 12px;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #111827);
}

.settings-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

#helpButton {
    width: 100%;
    min-height: var(--btn-h, 54px);
    padding: 12px 16px;
    font-size: 18px;
    background-color: var(--primary, #4285f4);
    color: var(--primary-contrast, #fff);
    border: 1px solid transparent;
    border-radius: var(--radius-btn, 16px);
    cursor: pointer;
    transition: none;
}

#helpButton:hover {
    transform: none;
    box-shadow: none;
    background-color: var(--primary, #3b82f6);
}

#helpButton:active {
    transform: none;
    box-shadow: none;
    background-color: var(--primary, #2563eb);
}

#helpButton:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Bottom status bar */
#status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px;
  color: #fff;
  font-weight: bold;
  text-align: center;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#status.status-idle {
  background: var(--surface-2, #1e3a8a);
}

#status.status-requested {
  background: var(--danger, #b91c1c);
}

/* Header follows status colors */
.app-header.status-idle {
  background: var(--surface-2, #1e3a8a);
  color: #fff;
  border-bottom-color: var(--surface-2, #1e3a8a);
}
.app-header.status-requested {
  background: var(--danger, #b91c1c);
  color: #fff;
  border-bottom-color: var(--danger, #b91c1c);
}
.app-header.status-idle .app-subtitle,
.app-header.status-requested .app-subtitle {
  color: #e5e7eb;
}
.app-header.status-idle .app-title,
.app-header.status-requested .app-title {
  color: #ffffff;
}

/* Modal styles */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-content { position: relative; background: var(--surface, #fff); color: var(--text, #111); padding: 24px; border-radius: var(--radius-card, 8px); min-width: 280px; max-width: 90vw; box-shadow: var(--shadow-1, 0 10px 30px rgba(0,0,0,0.2)); z-index: 1; border: 1px solid var(--border, transparent); }
.modal-content h2 { margin-bottom: 8px; font-size: 18px; }
.modal-content p { margin-bottom: 16px; }
.modal-content ul { margin: 0; padding-left: 20px; }
.modal-content li { margin: 8px 0; line-height: 1.5; }
.modal-close { background: var(--primary, #4285f4); color: var(--primary-contrast, #fff); border: 1px solid transparent; border-radius: var(--radius-btn, 4px); padding: 10px 14px; cursor: pointer; font-weight: 700; min-height: var(--tap-min, 44px); }

/* Auth + Contacts */
.auth {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  z-index: auto;
}

.contacts {
  width: 100%;
}

.login-row,
.contacts-row,
.me-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.login-row input,
.contacts-row input {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.login-status {
  font-size: 0.9rem;
  color: var(--muted, #374151);
}

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text, #111827);
}

.contacts-list {
  margin-top: 6px;
  max-height: 180px;
  overflow: auto;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
