:root {
  --bg: linear-gradient(165deg, #eef3fb 0%, #f6fafb 55%, #f9fbfd 100%);
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --border: #dce4f0;
  --text: #1f2937;
  --muted: #778293;
  --brand: #0ea5a0;
  --brand-dark: #0f766e;
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

.app-header {
  min-height: 68px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(4px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.4px;
  color: #0f172a;
}

.brand-icon {
  width: 32px;
  height: 32px;
  position: relative;
  display: inline-block;
}

.dot {
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(180deg, #4fd1ca 0%, #0891b2 100%);
}

.dot-a {
  width: 16px;
  height: 16px;
  left: 1px;
  top: 8px;
}

.dot-b {
  width: 14px;
  height: 14px;
  right: 1px;
  top: 2px;
}

.dot-c {
  width: 12px;
  height: 12px;
  right: 4px;
  bottom: 3px;
}

.app-header p {
  margin: 0;
  color: #9aa3af;
  font-size: 12px;
}

.main-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.05fr 2.6fr 1.55fr;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rebuttal-panel {
  border-right: 0;
}

.panel h2 {
  margin: 0;
  font-size: 19px;
  color: #1f2937;
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #374151;
}

.subheading {
  margin: 4px 0 14px;
  color: #8f9aa7;
  font-size: 11px;
}

.upload-dropzone {
  width: 100%;
  min-height: 208px;
  border: 2px dashed #d8e1eb;
  background: #f9fbfd;
  border-radius: 8px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
  border-color: #93d5d0;
  background: #f2fbfa;
}

.upload-icon {
  color: #6b7280;
  font-size: 44px;
  line-height: 1;
}

.upload-main {
  color: #586275;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  max-width: 270px;
}

.upload-sub {
  color: #6f7785;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 500;
}

.recent-docs {
  margin-top: 22px;
}

.recent-doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-doc-list li {
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: #f7f9fb;
  min-height: 48px;
  padding: 12px 14px;
  font-size: 12px;
  color: #4b5563;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.recent-doc-list li:hover {
  background: #edf7f6;
  border-color: #c4d9d7;
}

.recent-doc-list li::before {
  content: "\1F5CE";
  font-size: 20px;
  margin-right: 10px;
  opacity: 0.7;
}

.recent-doc-list li.muted {
  color: var(--muted);
  cursor: default;
}

.recent-doc-list li.muted::before {
  content: "";
  margin-right: 0;
}

.recent-doc-list li.recent-doc-selected {
  border-color: #99dbd4;
  background: #ecf9f7;
}

.arguments-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding-right: 2px;
}

.arguments-loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px dashed #c8dfdc;
  border-radius: 11px;
  background: #f4fbfa;
}

.arguments-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #9de3dc;
  border-top-color: #0f766e;
  border-radius: 999px;
  animation: rebuttal-spin 0.85s linear infinite;
  flex-shrink: 0;
}

.arguments-loading-title {
  margin: 0;
  color: #0f766e;
  font-size: 13px;
  font-weight: 600;
}

.arguments-loading-subtitle {
  margin: 2px 0 0;
  color: #607285;
  font-size: 12px;
}

.argument-card,
.precedent-card {
  border: 2px solid #e2e8ef;
  border-radius: 11px;
  background: var(--panel-strong);
  padding: 14px 16px;
}

.argument-card {
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.argument-card:hover {
  border-color: #9fd7d2;
}

.argument-card:focus-visible {
  outline: 2px solid #74c8c0;
  outline-offset: 2px;
}

.argument-card-selected {
  border-color: #35b7ad;
  box-shadow: var(--shadow-soft);
}

.argument-card-loading {
  opacity: 0.7;
  pointer-events: none;
}

.argument-title,
.precedent-title {
  margin: 0 0 8px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.argument-body,
.precedent-body {
  margin: 0;
  color: #5f6a7b;
  font-size: 11px;
  line-height: 1.5;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.hidden-panel {
  display: none;
}

.rebuttal-output {
  margin-top: 22px;
  flex: 1;
  border: 2px dashed transparent;
  border-radius: 8px;
  background: transparent;
  color: #8a95a4;
  font-size: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
  padding: 20px 14px;
}

.rebuttal-output-structured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
  justify-items: stretch;
  justify-content: stretch;
  text-align: left;
  white-space: normal;
}

.rebuttal-output-clickable {
  cursor: pointer;
}

.rebuttal-output-clickable:hover {
  border-color: #c8dfdc;
  background: #f5fcfb;
}

.rebuttal-output-loading {
  cursor: progress;
}

.rebuttal-loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #0f766e;
  font-size: 15px;
  font-weight: 600;
}

.rebuttal-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #9de3dc;
  border-top-color: #0f766e;
  border-radius: 999px;
  animation: rebuttal-spin 0.85s linear infinite;
}

@keyframes rebuttal-spin {
  to {
    transform: rotate(360deg);
  }
}

.rebuttal-section {
  margin-top: 0;
  text-align: left;
}

.rebuttal-section-title {
  margin: 0 0 6px;
  color: #223041;
  font-size: 12px;
}

.rebuttal-section-card {
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px 12px;
  color: #314155;
  font-size: 11px;
}

.rebuttal-case-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rebuttal-case-card {
  border: 1px solid #d3ece8;
  border-radius: 8px;
  background: #effbf9;
  padding: 9px 11px;
  color: #2f475b;
  font-size: 11px;
}

.rebuttal-section-empty {
  border: 1px dashed #cfd8e3;
  border-radius: 8px;
  padding: 10px 12px;
  color: #6d7989;
  background: #f8fafd;
  font-size: 11px;
}

.rebuttal-key-quote {
  margin: 0;
  border-left: 4px solid #1f2937;
  padding: 4px 0 4px 12px;
  color: #334155;
  font-style: italic;
  font-size: 11px;
}

.action-bar {
  position: static;
  height: 72px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 10px 14px;
  gap: 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(5px);
}

.status-text {
  flex: 1;
  min-width: 120px;
  color: #7a8796;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 38px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(180deg, #20baa9 0%, #0f9e8f 100%);
  color: #ffffff;
  border-color: #10988b;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #25c4b2 0%, #0fa292 100%);
}

.btn-light {
  background: #ffffff;
  color: #1f2937;
  border-color: #dce4ee;
}

.btn-light:hover:not(:disabled) {
  background: #f8fafc;
}

.btn-dark {
  background: #101828;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-dark:hover:not(:disabled) {
  background: #121e31;
}

@media (max-width: 1200px) {
  .app-shell {
    padding-bottom: 0;
  }

  .app-header {
    height: auto;
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .action-bar {
    position: static;
    height: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .status-text {
    white-space: normal;
  }

  .action-buttons {
    justify-content: flex-end;
  }
}
