/* QuoteForge local-first feature + polish layer.
   Loaded after styles.css so these rules intentionally refine the base UI. */

/* Global polish */
:focus-visible {
  outline: 3px solid rgba(91, 93, 240, .22);
  outline-offset: 2px;
}

.view {
  width: min(1280px, 100%);
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 {
  text-wrap: balance;
}

.panel {
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(35, 46, 72, .045);
}

.button,
.icon-button,
.nav-list a,
input,
select,
textarea {
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

.button:active {
  transform: translateY(0);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #cfd4df;
}

/* Quotes browser */
.quote-browser {
  min-height: 420px;
}

.quote-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px 150px;
  gap: 14px;
  align-items: end;
  padding: 18px 20px;
  background: #fbfcff;
  border-bottom: 1px solid var(--line, #e7eaf0);
}

.quote-filters .field > span {
  color: #626d82;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.quote-filters input,
.quote-filters select {
  height: 42px;
  background: #fff;
}

.search-field {
  position: relative;
}

.filter-count {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #e0e4ed;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.filter-count strong {
  color: var(--ink-2, #3d4659);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.filter-count span {
  font-size: 10px;
  opacity: .72;
}

.quote-browser .table-wrap {
  min-height: 300px;
  overflow-x: auto;
  background: #fff;
}

.quote-browser table {
  min-width: 720px;
}

.quote-browser th {
  height: 38px;
}

.quote-browser td {
  height: 58px;
}

.quote-browser .empty-state {
  min-height: 240px;
  padding: 68px 20px;
  display: grid;
  place-items: center;
  align-content: center;
}

.quote-browser .empty-state h3,
.quote-browser .empty-state p {
  width: 100%;
}

.quote-browser .empty-state h3 {
  font-size: 16px;
}

.quote-browser .empty-state p {
  margin-bottom: 0;
  font-size: 11px;
}

.quote-browser tbody tr:has(.empty-state):hover {
  background: transparent;
}

.actions-cell .icon-button {
  border: 1px solid transparent;
}

.actions-cell .icon-button:hover {
  border-color: #e4e7ee;
}

/* Local library */
.alert.info {
  color: #245ca8;
  border-color: rgba(59, 130, 246, .25);
  background: rgba(59, 130, 246, .08);
}

.alert.info span {
  color: #4e6f9e;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.library-grid .panel {
  min-width: 0;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.library-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eef0f4;
}

.library-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line, #e7eaf0);
  border-radius: 12px;
  background: #fcfdff;
}

.library-row:hover {
  border-color: #d8dce7;
  background: #fff;
}

.library-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.library-row span,
.library-row small {
  color: var(--muted, #778197);
  opacity: 1;
  overflow-wrap: anywhere;
}

.library-row span { font-size: 11px; }
.library-row small { font-size: 10px; }

.saved-shortcut {
  margin-bottom: 18px;
  max-width: 460px;
  padding: 12px;
  border: 1px solid #e9ebf1;
  border-radius: 12px;
  background: #fafbfe;
}

.line-item-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.compact-select {
  min-width: 220px;
  max-width: 320px;
  height: 34px;
  border: 1px solid #dfe3eb;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.empty-state.compact {
  min-height: 92px;
  padding: 22px 12px;
  border: 1px dashed #dfe3eb;
  border-radius: 12px;
  background: #fafbfe;
}

.empty-state.compact p {
  margin-bottom: 0;
}

/* Settings / branding / local data */
.settings-layout {
  max-width: 920px;
}

.logo-settings {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid #eceef3;
  border-radius: 14px;
  background: #fafbfe;
}

.logo-preview-box {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  border: 1px solid #dfe3eb;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.logo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.logo-settings > div:last-child {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.document-logo-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 10px;
}

.data-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.data-actions .button {
  min-width: 120px;
}

.file-button {
  cursor: pointer;
}

.data-note {
  margin-top: 12px !important;
  padding-top: 12px;
  border-top: 1px solid #eef0f4;
}

/* Better density and hierarchy for editor forms */
.form-panel {
  box-shadow: 0 8px 28px rgba(35, 46, 72, .035);
}

.section-title {
  margin-bottom: 20px;
}

.line-items-wrap {
  margin-top: 24px;
}

.summary-card {
  box-shadow: 0 10px 32px rgba(35, 46, 72, .07);
}

/* Responsive polish */
@media (max-width: 1100px) {
  .view {
    padding-inline: 34px;
  }
}

@media (max-width: 980px) {
  .quote-filters {
    grid-template-columns: minmax(0, 1fr) 180px;
  }

  .filter-count {
    grid-column: 1 / -1;
    justify-self: start;
    min-width: 150px;
  }
}

@media (max-width: 900px) {
  .library-grid {
    grid-template-columns: 1fr;
  }

  .line-item-tools {
    flex-wrap: wrap;
  }

  .compact-select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 780px) {
  .view {
    padding-inline: 18px;
  }

  .panel {
    border-radius: 14px;
  }

  .quote-browser {
    min-height: 360px;
  }

  .quote-browser .table-wrap {
    margin-inline: 0;
  }

  .page-heading {
    margin-bottom: 20px;
  }
}

@media (max-width: 680px) {
  .quote-filters {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }

  .filter-count {
    grid-column: auto;
    justify-self: stretch;
  }

  .quote-browser table {
    min-width: 680px;
  }

  .data-actions .button,
  .data-actions .file-button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .logo-settings {
    grid-template-columns: 72px 1fr;
    gap: 14px;
    padding: 14px;
  }

  .logo-preview-box {
    width: 72px;
    height: 72px;
  }
}

/* Native file picker polish */
input[type="file"] {
  height: auto;
  min-height: 40px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #fff;
  color: var(--muted, #778197);
  font-size: 11px;
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 0 12px;
  border: 1px solid #dfe3eb;
  border-radius: 8px;
  background: var(--brand-soft, #eeeeff);
  color: var(--brand, #5b5df0);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: #c8c9f7;
  background: #e5e5ff;
}
