/* Orizont — simulator de portofoliu. Extinde stilurile existente fără să le rescrie. */

[hidden] {
  display: none !important;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.mode-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.028);
}

.mode-tab {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.mode-tab:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab[aria-selected="true"] {
  border-color: rgba(255, 143, 180, 0.3);
  background: linear-gradient(120deg, rgba(255, 154, 98, 0.13), rgba(255, 95, 143, 0.16));
  color: #ffe4ea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mode-tab:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.mode-panel:focus {
  outline: none;
}

.mode-panel:focus-visible {
  outline: 2px solid rgba(255, 95, 143, 0.5);
  outline-offset: 4px;
  border-radius: 8px;
}

.app-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 154, 98, 0.28);
  border-radius: 14px;
  background: rgba(255, 154, 98, 0.08);
  color: #ffd0b0;
  font-size: 0.76rem;
  line-height: 1.55;
}

.app-notice p {
  margin: 0;
}

.app-notice-close {
  flex: none;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 154, 98, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #ffd0b0;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
}

.app-notice-close:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.hero--portfolio {
  max-width: 940px;
}

.share-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.share-note {
  flex: 1 1 190px;
  margin: 0;
  color: var(--muted-2);
  font-size: 0.64rem;
  line-height: 1.45;
}

.share-url {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 9px;
  background: rgba(3, 7, 16, 0.65);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.64rem;
}

.share-url:focus {
  outline: 2px solid rgba(255, 95, 143, 0.5);
  outline-offset: 1px;
}

.secondary-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-soft);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(255, 143, 180, 0.42);
  background: rgba(255, 95, 143, 0.1);
  color: #ffe4ea;
}

.secondary-button:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-button--small {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 0.65rem;
  white-space: nowrap;
}

.field-group--catalog {
  margin-bottom: 24px;
}

.field-group--catalog .group-note code,
.disclaimer code {
  color: #ffc6d5;
  font-family: var(--mono);
  font-size: 0.92em;
}

.catalog-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0;
}

.catalog-status {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--muted-2);
  font-size: 0.68rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.catalog-status.is-ok {
  color: #9ed7b8;
}

.catalog-status.is-warn {
  color: #ffc28d;
}

.catalog-status.is-error {
  color: #ff9ba8;
}

.instrument-list {
  max-height: 330px;
  margin-top: 10px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 14px;
  background: rgba(3, 7, 16, 0.32);
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.instrument-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 84px;
  grid-template-rows: auto auto;
  gap: 2px 9px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  transition: background 150ms ease;
}

.instrument-row:last-child {
  border-bottom: 0;
}

.instrument-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.instrument-row.is-selected {
  background: linear-gradient(90deg, rgba(255, 95, 143, 0.075), rgba(155, 108, 255, 0.04));
}

.instrument-row.is-missing {
  background: rgba(255, 154, 98, 0.055);
}

.instrument-toggle {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--pink);
  cursor: pointer;
}

.instrument-name {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  color: #dbe4f1;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.instrument-row.is-selected .instrument-name {
  color: #fff;
}

.instrument-rate {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instrument-rate.is-changed {
  color: #ffc28d;
}

.instrument-rate.is-missing {
  color: #ffb18b;
}

.instrument-row .input-shell {
  grid-column: 3;
  grid-row: 1 / 3;
}

.input-shell--mini input {
  height: 36px;
  padding: 0 24px 0 8px;
  border-radius: 9px;
  font-size: 0.8rem;
  text-align: right;
}

.input-shell--mini .unit {
  right: 7px;
  font-size: 0.6rem;
}

.input-shell--mini input:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.instrument-empty {
  margin: 0;
  padding: 14px;
  color: var(--muted-2);
  font-size: 0.7rem;
  line-height: 1.55;
  text-align: center;
}

.instrument-row.is-custom {
  background: linear-gradient(90deg, rgba(155, 108, 255, 0.1), rgba(109, 156, 255, 0.035));
}

.instrument-remove {
  grid-column: 1;
  grid-row: 1 / 3;
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(155, 108, 255, 0.3);
  border-radius: 7px;
  background: rgba(155, 108, 255, 0.1);
  color: #d8c8ff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.instrument-remove:hover {
  border-color: rgba(255, 154, 98, 0.5);
  background: rgba(255, 154, 98, 0.12);
  color: #ffd0b0;
}

.instrument-remove:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.instrument-row.is-custom .instrument-name {
  color: #f0eaff;
}

.instrument-rate.is-custom {
  color: #c8b8ff;
}

.custom-instrument {
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed rgba(155, 108, 255, 0.3);
  border-radius: 14px;
  background: rgba(155, 108, 255, 0.045);
}

.custom-title {
  margin: 0;
  color: #e7ddff;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.custom-note {
  margin: 5px 0 10px;
  color: var(--muted-2);
  font-size: 0.62rem;
  line-height: 1.5;
}

.custom-note code {
  color: #d8c8ff;
  font-family: var(--mono);
  font-size: 0.94em;
}

.custom-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px auto;
  gap: 8px;
  align-items: end;
}

.custom-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.custom-field label {
  color: #c8d3e5;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.custom-field > input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 9px;
  outline: none;
  background: rgba(4, 9, 20, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 0.74rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.custom-field > input:hover {
  border-color: rgba(148, 163, 184, 0.28);
}

.custom-field > input:focus {
  border-color: rgba(155, 108, 255, 0.7);
  background: rgba(4, 9, 20, 0.82);
  box-shadow:
    0 0 0 3px rgba(155, 108, 255, 0.14),
    inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.custom-field .input-shell--mini input {
  height: 36px;
  text-align: left;
}

.custom-add {
  min-height: 36px;
  border-color: rgba(155, 108, 255, 0.35);
  background: rgba(155, 108, 255, 0.12);
  color: #eadfff;
}

.custom-add:hover:not(:disabled) {
  border-color: rgba(155, 108, 255, 0.58);
  background: rgba(155, 108, 255, 0.2);
  color: #f5efff;
}

.custom-instrument .field-error {
  margin-top: 8px;
}

.allocation-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.allocation-summary strong {
  color: #e8edf6;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
}

.allocation-summary.is-ok strong {
  color: #9ed7b8;
}

.allocation-summary.is-warn strong {
  color: #ffc28d;
}

.allocation-summary.is-error strong {
  color: #ff9ba8;
}

.snapshot-note {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 154, 98, 0.18);
  border-radius: 11px;
  background: rgba(255, 154, 98, 0.045);
  color: #d9c1b4;
  font-size: 0.66rem;
  line-height: 1.55;
}

.snapshot-note strong {
  color: #ffd0b0;
}

.snapshot-note ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

#refresh-rates {
  margin-top: 9px;
}

.portfolio-holdings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 11px;
}

.holding-card {
  --tone: var(--pink);
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  border-radius: 17px;
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--tone) 7%, transparent), rgba(10, 17, 33, 0.62));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.holding-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.holding-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #eef3fa;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.holding-tone {
  width: 7px;
  height: 7px;
  flex: none;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tone) 65%, transparent);
}

.holding-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 5px 0 0;
  color: var(--muted-2);
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
}

.holding-facts {
  display: grid;
  gap: 5px;
  margin: 11px 0 0;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.holding-fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.holding-fact dt {
  color: var(--muted-2);
  font-size: 0.62rem;
}

.holding-fact dd {
  margin: 0;
  color: #dbe4f1;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  text-align: right;
  overflow-wrap: anywhere;
}

.holding-fact dd.is-negative {
  color: #ff8f9e;
}

.holding-final {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 9px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.holding-final span {
  color: var(--muted-2);
  font-size: 0.6rem;
}

.holding-final strong {
  color: #fff;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  font-weight: 730;
  letter-spacing: -0.02em;
  text-align: right;
  overflow-wrap: anywhere;
}

.portfolio-source {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 0.64rem;
  line-height: 1.5;
}

.portfolio-hero .hero-value {
  font-size: clamp(2.1rem, 4vw, 3.25rem);
}

.charts-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.portfolio-evolution-card .chart-canvas {
  min-height: 320px;
}

.portfolio-table {
  min-width: 760px;
}

.portfolio-table th:not(:first-child),
.portfolio-table td:not(:first-child) {
  text-align: right;
}

.portfolio-table tbody th {
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .portfolio-holdings {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .header-tools {
    gap: 10px;
  }

  .mode-tab {
    padding: 0 11px;
    font-size: 0.68rem;
  }
}

@media (max-width: 760px) {
  .site-header {
    gap: 14px;
  }

  .header-tools {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    font-size: 0.68rem;
  }

  .currency-control {
    width: 100%;
  }

  .portfolio-holdings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-notice {
    flex-direction: column;
  }

  .share-bar {
    align-items: stretch;
  }

  .share-bar .secondary-button {
    width: 100%;
  }

  .share-note {
    flex-basis: auto;
  }
}

@media (max-width: 560px) {
  .instrument-list {
    max-height: 290px;
  }

  .instrument-row {
    grid-template-columns: 18px minmax(0, 1fr) 76px;
    padding: 8px;
  }

  .custom-fields {
    grid-template-columns: minmax(0, 1fr) 100px;
  }

  .custom-add {
    grid-column: 1 / -1;
  }

  .portfolio-holdings {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 400px) {
  .mode-tab {
    font-size: 0.64rem;
    letter-spacing: -0.01em;
  }

  .instrument-row {
    grid-template-columns: 17px minmax(0, 1fr) 70px;
    gap: 2px 7px;
  }
}
