.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 28px 22px;
  background:
    radial-gradient(circle at top, rgba(15, 98, 254, 0.2), transparent 24%),
    linear-gradient(180deg, #09101d 0%, #0e1628 52%, #0f172a 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f8fbff 0%, #b8ceff 100%);
  color: #0f172a;
  box-shadow: 0 16px 28px rgba(15, 98, 254, 0.22);
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  display: flex !important;
  align-items: baseline;
  gap: 6px 8px;
  flex-wrap: wrap;
  line-height: 1.05;
}

.brand-title-main {
  font-size: 1.02rem;
  font-weight: 800;
  color: #f8fafc;
}

.brand-title-suffix {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(248, 250, 252, 0.64);
}

.brand-tagline {
  margin-top: 6px;
  color: rgba(248, 250, 252, 0.62);
  font-size: 0.9rem;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  width: 100%;
  border: 0;
  padding: 15px 16px;
  background: transparent;
  color: rgba(248, 250, 252, 0.92);
  border-radius: 18px;
  text-align: left;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.nav-link.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-label,
.nav-meta {
  display: block;
}

.nav-label {
  font-weight: 700;
  margin-bottom: 4px;
}

.nav-meta {
  font-size: 0.84rem;
  color: rgba(248, 250, 252, 0.56);
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 16px;
}

.company-switch {
  display: grid;
  gap: 8px;
}

.company-switch label {
  font-size: 0.86rem;
  color: rgba(248, 250, 252, 0.64);
}

.company-switch select {
  background: var(--sidebar-bg-soft);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-note {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note strong {
  margin-bottom: 6px;
}

.workspace {
  padding: 28px;
}

.workspace-header {
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.workspace-header h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  margin-bottom: 8px;
}

.dashboard-grid {
  display: grid;
  gap: 20px;
}

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

.editor-grid {
  grid-template-columns: 1.1fr 0.65fr;
}

.settings-grid {
  grid-template-columns: 1fr;
}

.wide-panel,
.full-panel {
  grid-column: 1 / -1;
}

.hero-panel {
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 98, 254, 0.16), transparent 70%);
  pointer-events: none;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.hero-panel h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 10px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-hero-panel {
  background:
    radial-gradient(circle at top right, rgba(15, 98, 254, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 250, 255, 0.96) 100%);
}

.dashboard-quick-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f7fb 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.metric-card.emphasis {
  background: linear-gradient(135deg, rgba(15, 98, 254, 0.12), rgba(15, 98, 254, 0.04));
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-card strong {
  font-size: 1.25rem;
}

.metric-footnote {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.summary-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 251, 255, 0.96) 100%);
}

.template-panel {
  background:
    radial-gradient(circle at top right, rgba(15, 98, 254, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 251, 255, 0.98) 100%);
}

.template-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.template-selector-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
  box-shadow: var(--shadow-sm);
  text-align: left;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.template-selector-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 98, 254, 0.24);
  box-shadow: var(--shadow-md);
}

.template-selector-card.active {
  border-color: rgba(15, 98, 254, 0.48);
  background: linear-gradient(180deg, rgba(240, 246, 255, 0.98) 0%, rgba(230, 240, 255, 0.98) 100%);
  box-shadow: 0 18px 36px rgba(15, 98, 254, 0.12);
}

.template-selector-preview {
  position: relative;
  min-height: 236px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 20px;
  overflow: hidden;
  padding: 14px 10px;
  isolation: isolate;
}

.template-selector-card:hover .template-thumb-sheet,
.template-selector-card:hover .template-thumb-cover-sheet {
  transform: translateY(-1px);
}

.template-thumb-sheet,
.template-thumb-cover-sheet {
  position: relative;
  width: min(100%, 154px);
  aspect-ratio: 210 / 297;
  border-radius: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.template-thumb-sheet {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

.template-thumb-sheet-back {
  position: absolute;
  right: 4px;
  bottom: 6px;
  width: 106px;
  z-index: 1;
  transform: rotate(5deg);
  opacity: 0.97;
}

.template-thumb-header-row,
.template-thumb-band {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.template-thumb-header-row.construction {
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(120, 53, 15, 0.34);
}

.template-thumb-brand {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 58%;
  min-width: 0;
}

.template-thumb-brand-copy {
  flex: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.template-thumb-doc-meta {
  width: 32%;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.template-thumb-doc-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.92);
  color: #475569;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.template-thumb-doc-kind.is-invoice {
  border-color: rgba(37, 99, 235, 0.18);
  background: rgba(219, 234, 254, 0.9);
  color: #1d4ed8;
}

.template-thumb-doc-kind.is-quote {
  border-color: rgba(146, 64, 14, 0.18);
  background: rgba(255, 237, 213, 0.9);
  color: #9a3412;
}

.template-thumb-doc-kind.is-credit {
  border-color: rgba(153, 27, 27, 0.16);
  background: rgba(254, 226, 226, 0.88);
  color: #b91c1c;
}

.template-thumb-mark {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
  flex: 0 0 auto;
}

.template-thumb-mark.light {
  background: rgba(255, 255, 255, 0.9);
}

.template-thumb-mark.gold {
  background: linear-gradient(135deg, #c89d54 0%, #f1dfb1 100%);
}

.template-thumb-title,
.template-thumb-line,
.template-thumb-doc-title,
.template-thumb-section-label,
.template-thumb-subject,
.template-thumb-project,
.template-thumb-table-head,
.template-thumb-strip,
.template-thumb-note-box,
.template-thumb-total-box,
.template-thumb-cover-kicker,
.template-thumb-cover-title,
.template-thumb-cover-name,
.template-thumb-cover-divider,
.template-thumb-cover-date,
.template-thumb-annex-title,
.template-thumb-annex-line,
.template-thumb-row,
.template-thumb-footer-line {
  display: block;
  border-radius: 999px;
}

.template-thumb-title {
  flex: 1;
  height: 9px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.94) 0%, rgba(203, 213, 225, 0.94) 100%);
}

.template-thumb-title.short {
  max-width: 54%;
}

.template-thumb-line {
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.74) 0%, rgba(226, 232, 240, 0.94) 100%);
}

.template-thumb-line.short {
  max-width: 72%;
}

.template-thumb-line.muted {
  opacity: 0.74;
}

.template-thumb-title.light {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(219, 234, 254, 0.88) 100%);
}

.template-thumb-line.light,
.template-thumb-doc-title.light {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(219, 234, 254, 0.88) 100%);
}

.template-thumb-line.gold,
.template-thumb-doc-title.gold {
  background: linear-gradient(90deg, rgba(186, 153, 92, 0.92) 0%, rgba(239, 223, 188, 0.96) 100%);
}

.template-thumb-doc-title {
  width: 100%;
  height: 14px;
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.9) 0%, rgba(226, 232, 240, 0.96) 100%);
}

.template-thumb-section-label {
  width: 26%;
  height: 5px;
  background: rgba(148, 163, 184, 0.46);
}

.template-thumb-section-label.blue {
  background: rgba(37, 99, 235, 0.44);
}

.template-thumb-section-label.amber {
  background: rgba(146, 64, 14, 0.52);
}

.template-thumb-section-label.gold {
  background: rgba(173, 137, 73, 0.62);
}

.template-thumb-subject {
  width: 78%;
  height: 11px;
  background: linear-gradient(90deg, rgba(71, 85, 105, 0.86) 0%, rgba(203, 213, 225, 0.92) 100%);
}

.template-thumb-top-grid,
.template-thumb-bottom-grid {
  display: grid;
  gap: 7px;
}

.template-thumb-top-grid {
  grid-template-columns: 0.82fr 1.18fr;
}

.template-thumb-bottom-grid {
  grid-template-columns: 1.08fr 0.78fr;
  margin-top: auto;
}

.template-thumb-box,
.template-thumb-copy-block,
.template-thumb-note-box,
.template-thumb-total-box,
.template-thumb-annex-box {
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f8fafc;
}

.template-thumb-box {
  min-height: 38px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.template-thumb-copy-block {
  min-height: 38px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%),
    repeating-linear-gradient(
      180deg,
      rgba(148, 163, 184, 0.58) 0,
      rgba(148, 163, 184, 0.58) 2px,
      transparent 2px,
      transparent 10px
    );
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.template-thumb-project {
  height: 18px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.96) 100%);
}

.template-thumb-table-head {
  height: 8px;
  border-bottom: 2px solid #334155;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.28) 0%, rgba(226, 232, 240, 0.22) 100%);
}

.template-thumb-table-head.blue {
  border-bottom-color: #1d4ed8;
}

.template-thumb-table-head.amber {
  border-bottom-color: #92400e;
}

.template-thumb-table-head.gold {
  border-bottom-color: #8d6b34;
}

.template-thumb-table {
  display: grid;
  gap: 5px;
}

.template-thumb-table.strong .template-thumb-row {
  height: 8px;
}

.template-thumb-row {
  height: 6px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.72) 0%, rgba(226, 232, 240, 0.92) 100%);
}

.template-thumb-row.short {
  max-width: 68%;
}

.template-thumb-page-body {
  display: grid;
  gap: 6px;
}

.template-thumb-note-box {
  min-height: 34px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.96) 100%),
    repeating-linear-gradient(
      180deg,
      rgba(148, 163, 184, 0.34) 0,
      rgba(148, 163, 184, 0.34) 2px,
      transparent 2px,
      transparent 10px
    );
}

.template-thumb-total-box {
  min-height: 34px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.96) 100%);
}

.template-thumb-strip {
  height: 12px;
  margin-top: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  background: linear-gradient(90deg, rgba(226, 232, 240, 0.8) 0%, rgba(248, 250, 252, 0.96) 100%);
}

.template-thumb-strip.blue {
  border-top-color: rgba(37, 99, 235, 0.24);
}

.template-thumb-note-box.blue,
.template-thumb-total-box.blue,
.template-thumb-box.blue,
.template-thumb-copy-block.blue,
.template-thumb-strip.blue {
  border-color: rgba(29, 78, 216, 0.18);
}

.template-thumb-note-box.amber,
.template-thumb-total-box.amber,
.template-thumb-box.amber,
.template-thumb-copy-block.amber,
.template-thumb-project.amber {
  border-color: rgba(146, 64, 14, 0.18);
}

.template-thumb-note-box.gold,
.template-thumb-total-box.gold {
  border-color: rgba(141, 107, 52, 0.2);
}

.template-thumb-footer-line {
  height: 5px;
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.7) 0%, rgba(241, 245, 249, 0.98) 100%);
}

.template-thumb-annex-box {
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid rgba(120, 53, 15, 0.44);
  background: rgba(255, 248, 235, 0.92);
}

.template-thumb-annex-title {
  width: 52%;
  height: 8px;
  background: rgba(120, 53, 15, 0.9);
}

.template-thumb-annex-line {
  height: 6px;
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.44) 0%, rgba(251, 191, 36, 0.32) 100%);
}

.template-thumb-annex-line.short {
  max-width: 72%;
}

.template-thumb-stack {
  position: relative;
  width: min(100%, 160px);
  min-height: 218px;
}

.template-thumb-cover-sheet {
  position: absolute;
  left: 10px;
  top: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(194, 164, 110, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(21, 29, 39, 0.98) 0%, rgba(34, 40, 49, 0.98) 100%);
  border: 1px solid rgba(194, 164, 110, 0.2);
  box-shadow: 0 18px 36px rgba(8, 10, 14, 0.28);
}

.template-thumb-cover-mark {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(194, 164, 110, 0.34);
  background: rgba(255, 248, 235, 0.06);
}

.template-thumb-cover-kicker {
  width: 40%;
  height: 5px;
  background: rgba(194, 164, 110, 0.72);
}

.template-thumb-cover-divider {
  width: 30%;
  height: 1px;
  background: rgba(194, 164, 110, 0.56);
}

.template-thumb-cover-title {
  width: 54%;
  height: 8px;
  background: linear-gradient(90deg, rgba(229, 217, 194, 0.94) 0%, rgba(194, 164, 110, 0.72) 100%);
}

.template-thumb-cover-name {
  width: 70%;
  height: 13px;
  background: linear-gradient(90deg, rgba(246, 239, 227, 0.92) 0%, rgba(215, 194, 151, 0.8) 100%);
}

.template-thumb-cover-date {
  width: 34%;
  height: 4px;
  background: rgba(210, 191, 152, 0.42);
}

.template-selector-preview-minimal {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background:
    radial-gradient(circle at top, rgba(148, 163, 184, 0.12), transparent 56%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.template-selector-preview-corporate {
  background:
    linear-gradient(135deg, #244c84 0%, #0f172a 100%);
}

.template-selector-preview-corporate .template-thumb-band {
  margin: -10px -10px 2px;
  padding: 10px;
  background: linear-gradient(135deg, #1b3e6e 0%, #2b5b99 100%);
  border-radius: 13px 13px 8px 8px;
}

.template-selector-preview-corporate .template-thumb-copy-block {
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.96) 0%, rgba(240, 246, 255, 0.98) 100%),
    repeating-linear-gradient(
      180deg,
      rgba(35, 82, 140, 0.38) 0,
      rgba(35, 82, 140, 0.38) 2px,
      transparent 2px,
      transparent 10px
    );
}

.template-selector-preview-corporate .template-thumb-row {
  background: linear-gradient(90deg, rgba(35, 82, 140, 0.72) 0%, rgba(188, 210, 236, 0.94) 100%);
}

.template-selector-preview-corporate .template-thumb-doc-title,
.template-selector-preview-corporate .template-thumb-title {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92) 0%, rgba(220, 232, 248, 0.92) 100%);
}

.template-selector-preview-construction {
  border: 2px solid rgba(120, 53, 15, 0.72);
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, 0.14), transparent 58%),
    linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
}

.template-selector-preview-construction .template-thumb-row {
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.78) 0%, rgba(251, 191, 36, 0.5) 100%);
}

.template-selector-preview-premium {
  border: 1px solid rgba(198, 163, 92, 0.34);
  background:
    radial-gradient(circle at top, rgba(194, 164, 110, 0.18), transparent 58%),
    linear-gradient(180deg, #151c25 0%, #252d37 100%);
}

.template-selector-preview-premium .template-thumb-sheet-back {
  background: rgba(251, 247, 238, 0.98);
  box-shadow: 0 14px 28px rgba(4, 6, 10, 0.24);
}

.template-selector-preview-premium .template-thumb-row,
.template-selector-preview-premium .template-thumb-title {
  background: linear-gradient(90deg, rgba(173, 137, 73, 0.82) 0%, rgba(239, 219, 178, 0.92) 100%);
}

.template-selector-preview-premium .template-thumb-subject {
  background: linear-gradient(90deg, rgba(90, 69, 40, 0.84) 0%, rgba(214, 193, 155, 0.92) 100%);
}

.template-selector-grid[data-document-kind="invoice"] .template-thumb-project {
  opacity: 0.34;
}

.template-selector-grid[data-document-kind="invoice"] .template-thumb-note-box {
  min-height: 28px;
}

.template-selector-grid[data-document-kind="invoice"] .template-thumb-total-box {
  min-height: 38px;
  background:
    linear-gradient(180deg, rgba(230, 238, 250, 0.98) 0%, rgba(214, 226, 244, 0.98) 100%);
}

.template-selector-grid[data-document-kind="quote"] .template-thumb-project {
  opacity: 1;
}

.template-selector-grid[data-document-kind="quote"] .template-thumb-note-box {
  min-height: 40px;
}

.template-selector-grid[data-document-kind="quote"] .template-thumb-total-box {
  min-height: 28px;
  background:
    linear-gradient(180deg, rgba(250, 245, 236, 0.96) 0%, rgba(245, 238, 224, 0.96) 100%);
}

.template-selector-grid[data-document-kind="quote"] .template-thumb-subject {
  width: 88%;
}

.template-selector-grid[data-document-kind="quote"] .template-selector-preview-premium .template-thumb-cover-sheet {
  opacity: 1;
}

.template-selector-grid[data-document-kind="quote"] .template-selector-preview-premium .template-thumb-sheet-back {
  position: absolute;
  right: 4px;
  bottom: 6px;
  width: 106px;
  transform: rotate(5deg);
}

.template-selector-grid[data-document-kind="credit"] .template-thumb-project {
  opacity: 0;
  height: 0;
  border-width: 0;
}

.template-selector-grid[data-document-kind="credit"] .template-thumb-subject {
  width: 70%;
}

.template-selector-grid[data-document-kind="credit"] .template-thumb-row:first-child {
  max-width: 84%;
}

.template-selector-grid[data-document-kind="credit"] .template-thumb-total-box {
  min-height: 34px;
  background:
    linear-gradient(180deg, rgba(254, 242, 242, 0.98) 0%, rgba(254, 226, 226, 0.98) 100%);
  border-color: rgba(185, 28, 28, 0.16);
}

.template-selector-grid[data-document-kind="credit"] .template-thumb-note-box {
  min-height: 26px;
}

.template-selector-grid[data-document-kind="invoice"] .template-selector-preview-premium .template-thumb-cover-sheet,
.template-selector-grid[data-document-kind="credit"] .template-selector-preview-premium .template-thumb-cover-sheet {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.template-selector-grid[data-document-kind="invoice"] .template-selector-preview-premium .template-thumb-sheet-back,
.template-selector-grid[data-document-kind="credit"] .template-selector-preview-premium .template-thumb-sheet-back {
  position: relative;
  right: auto;
  bottom: auto;
  width: min(100%, 154px);
  transform: none;
}

.template-selector-copy strong,
.template-selector-copy span {
  display: block;
}

.template-selector-copy strong {
  margin-bottom: 6px;
  font-size: 0.94rem;
  color: var(--text);
}

.template-selector-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.company-summary {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f7fc 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  line-height: 1.8;
}

.dashboard-company-card span {
  display: block;
}

.dashboard-company-card span + span {
  margin-top: 6px;
}

.dashboard-mini-stack,
.dashboard-activity-list {
  display: grid;
  gap: 14px;
}

.dashboard-mini-item,
.dashboard-document {
  padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f7fb 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.dashboard-mini-head,
.dashboard-document-head,
.dashboard-document-meta,
.dashboard-document-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-mini-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.dashboard-mini-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dashboard-mini-item strong {
  display: block;
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.dashboard-mini-item small {
  display: block;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-document {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-document-main {
  min-width: 0;
}

.dashboard-document-customer {
  margin: 0 0 10px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}

.dashboard-document-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-document-side {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 12px;
}

.dashboard-document-total {
  white-space: nowrap;
  font-size: 1.12rem;
}

.dashboard-document-actions {
  justify-content: flex-end;
}

.dashboard-empty {
  padding: 20px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
}

.notes-panel textarea {
  height: 100%;
}

.notes-panel-stack {
  display: grid;
  gap: 18px;
}

.notes-field {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.92rem;
}

.notes-field span {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.notes-field textarea {
  min-height: 148px;
}

.notes-field input {
  min-height: 52px;
}

.totals-panel {
  display: flex;
  align-items: stretch;
}

.totals-stack {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 14px 4px;
}

.total-row {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.total-row.grand {
  font-size: 1.12rem;
  border-bottom: 0;
}

.actions-panel {
  display: flex;
  justify-content: flex-end;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

@media (max-width: 1200px) {
  .overview-grid,
  .editor-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .workspace {
    padding: 18px;
  }

  .workspace-header,
  .panel-top,
  .panel-head-split {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-quick-actions,
  .dashboard-document-actions {
    justify-content: flex-start;
  }

  .dashboard-document {
    flex-direction: column;
  }

  .dashboard-document-side {
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .hero-metrics,
  .dashboard-metric-grid {
    grid-template-columns: 1fr;
  }

  .template-selector-grid {
    grid-template-columns: 1fr;
  }
}

/* Timesheet View Styling */
.timesheet-grid {
  grid-template-columns: 1fr;
}

.ts-delete-btn {
  margin-left: auto;
}

@media (min-width: 960px) {
  .timesheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Dashboard Chart Container */
.dashboard-chart-container { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.chart-bar-row { display: grid; grid-template-columns: 140px 1fr 100px; gap: 12px; align-items: center; font-size: 0.85rem; }
.chart-bar-row .chart-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #334155; }
.chart-bar-track { background: rgba(148, 163, 184, 0.12); border-radius: 6px; height: 16px; width: 100%; overflow: hidden; position: relative; }
.chart-bar-fill { background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%); height: 100%; border-radius: 6px; transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.chart-bar-row .chart-value { font-weight: 600; text-align: right; color: #64748b; font-variant-numeric: tabular-nums; }
.chart-empty { padding: 24px; text-align: center; color: #94a3b8; font-style: italic; }
