:root {
  --bv-primary: #1e3a8a;
  --bv-primary-hover: #1e40af;
  --bv-danger: #dc2626;
  --bv-success: #16a34a;
  --bv-text: #1f2937;
  --bv-muted: #6b7280;
  --bv-border: #e5e7eb;
  --bv-bg: #f9fafb;
}

html,
body,
#container {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bv-bg);
  color: var(--bv-text);
  box-sizing: border-box;
}

#container > * {
  flex: 1 1 auto;
  min-height: 0;
}

.license-shell {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

.license-card {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--bv-border);
  border-radius: 8px;
  padding: 24px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-header {
  text-align: center;
}

.brand-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  background: #000000;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 6px;
  font-weight: 600;
}

.subtitle {
  font-size: 0.82rem;
  color: var(--bv-muted);
  margin: 0;
  line-height: 1.35;
}

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

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bv-text);
}

input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--bv-border);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  width: 100%;
}

input[type="text"]:focus {
  border-color: var(--bv-primary);
}

.primary-btn,
.secondary-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  display: inline-block;
  text-align: center;
  box-sizing: border-box;
  text-decoration: none;
}

.primary-btn {
  background-color: var(--bv-primary);
  color: #ffffff;
}

.primary-btn:hover {
  background-color: var(--bv-primary-hover);
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.secondary-btn {
  background-color: transparent;
  color: var(--bv-muted);
  border: 1px solid var(--bv-border);
}

.secondary-btn:hover {
  background-color: #f3f4f6;
}

.link-btn {
  color: #ffffff;
}

.status-msg {
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: 5px;
  margin-bottom: 8px;
}

.error-msg {
  display: none;
  background-color: #fef2f2;
  color: var(--bv-danger);
  border: 1px solid #fecaca;
}

.error-msg.is-visible {
  display: block;
}

.badge-expired {
  display: inline-block;
  background: #fee2e2;
  color: var(--bv-danger);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.badge-active {
  background: #dcfce7;
  color: var(--bv-success);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sign-out-btn {
  background: transparent;
  border: 1px solid var(--bv-border);
  color: var(--bv-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.sign-out-btn:hover {
  background: #f3f4f6;
  color: var(--bv-text);
}

.support-footer,
.license-contact-text {
  font-size: 0.75rem;
  text-align: center;
  color: var(--bv-muted);
  margin: 0;
}

.support-footer a,
.license-contact-text a {
  color: var(--bv-primary);
  text-decoration: none;
  font-weight: 600;
}

.support-footer a:hover,
.license-contact-text a:hover {
  text-decoration: underline;
}

.expired-details {
  font-size: 0.82rem;
  color: var(--bv-muted);
  line-height: 1.35;
  margin: 0;
}

.expired-details p {
  margin: 0;
}

.license-checking {
  color: var(--bv-muted);
}

.main-app-view {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bv-bg);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--bv-border);
  color: var(--bv-text);
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
}

.org-name {
  font-weight: 500;
  color: var(--bv-muted);
}

.app-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header-container {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.content-container {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.tab-navigation {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 8px 4px;
  z-index: 100;
  overflow-x: auto;
  white-space: nowrap;
}

.tab-navigation .fui-TabList {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.tab-navigation .fui-Tab,
.tab-navigation button {
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.2;
  min-width: auto;
  flex-direction: column;
  padding: 4px 6px;
}

.tab-navigation .fui-Tab[disabled],
.tab-navigation .fui-Tab[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.bv-md {
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.bv-md p,
.bv-md ul,
.bv-md ol {
  margin: 0 0 8px;
}

.bv-md p:last-child,
.bv-md ul:last-child,
.bv-md ol:last-child {
  margin-bottom: 0;
}

.bv-md ul,
.bv-md ol {
  padding-left: 18px;
}

.bv-md li {
  margin: 2px 0;
}

.bv-md-h {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  margin: 10px 0 4px;
}

.bv-md-h1,
.bv-md-h2 {
  font-size: 14px;
}

.bv-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.clause-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clause-count {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  color: #374151;
}

.clause-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clause-filter {
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #1f2937;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
}

.clause-filter.is-active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #ffffff;
}

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

.clause-group-label {
  margin: 4px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.clause-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.clause-item-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.clause-item-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clause-item-name {
  font-weight: 650;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.clause-item-status {
  font-size: 11px;
  color: #6b7280;
}

.clause-item-body {
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clause-meta,
.clause-meta-label {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

.clause-meta-label {
  font-weight: 700;
  color: #374151;
}

.clause-citation {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-left: 3px solid #1e3a8a;
  background: #f8fafc;
}

.clause-quote {
  margin: 0;
  font-size: 12px;
  white-space: pre-wrap;
}

.clause-redline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #e5e7eb;
}

.clause-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clause-empty {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.ask-answer,
.ask-error {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ask-citations {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.ask-citations .fui-Button {
  justify-content: flex-start;
  text-align: left;
  height: auto;
  white-space: normal;
}
