:root {
  --ttmt-primary: var(--color-primary, #26368f);
  --ttmt-surface: var(--color-surface, #fff);
  --ttmt-bg: var(--color-background, #f4f7fb);
  --ttmt-text: var(--color-text, #172033);
  --ttmt-muted: var(--color-text-muted, #58657a);
  --ttmt-border: var(--color-border, #d7dfec);
  --ttmt-danger: #b42318;
  --ttmt-success: #067647;
}

.ttmt-page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 64px;
  color: var(--ttmt-text);
  font-family: 'Roboto', Arial, sans-serif;
}
.ttmt-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--ttmt-border);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--ttmt-surface), color-mix(in srgb, var(--ttmt-primary) 7%, var(--ttmt-surface)));
  box-shadow: 0 14px 34px rgba(31, 49, 86, .08);
}
.ttmt-hero h1 { margin: 4px 0 8px; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; }
.ttmt-hero p { max-width: 760px; margin: 0; color: var(--ttmt-muted); line-height: 1.6; }
.ttmt-eyebrow { color: var(--ttmt-primary) !important; font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ttmt-hero-actions, .ttmt-filter-actions, .ttmt-review-actions, .ttmt-source-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ttmt-action-form { display: inline-flex; }
.ttmt-button {
  box-sizing: border-box;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid var(--ttmt-border);
  border-radius: 10px;
  background: var(--ttmt-surface);
  color: var(--ttmt-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.ttmt-button:hover { border-color: var(--ttmt-primary); }
.ttmt-button:focus-visible, .ttmt-field input:focus-visible, .ttmt-field select:focus-visible, .ttmt-field textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ttmt-primary) 30%, transparent);
  outline-offset: 2px;
}
.ttmt-button-primary { border-color: var(--ttmt-primary); background: var(--ttmt-primary); color: #fff; }
.ttmt-button-danger { border-color: color-mix(in srgb, var(--ttmt-danger) 45%, var(--ttmt-border)); color: var(--ttmt-danger); }
.ttmt-button:disabled { opacity: .55; cursor: wait; }
.ttmt-filters, .ttmt-panel, .ttmt-review-card {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--ttmt-border);
  border-radius: 16px;
  background: var(--ttmt-surface);
}
.ttmt-filters { display: grid; grid-template-columns: minmax(230px, 2fr) repeat(4, minmax(125px, 1fr)) auto; gap: 14px; align-items: end; }
.ttmt-filter-actions { justify-content: flex-end; }
.ttmt-field { display: grid; gap: 7px; color: var(--ttmt-muted); font-size: .86rem; font-weight: 700; }
.ttmt-field input, .ttmt-field select, .ttmt-field textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--ttmt-border);
  border-radius: 9px;
  background: var(--ttmt-surface);
  color: var(--ttmt-text);
  font: inherit;
}
.ttmt-field textarea { resize: vertical; line-height: 1.55; }
.ttmt-result-head { margin: 28px 0 14px; }
.ttmt-result-head h2 { margin: 0; }
.ttmt-count { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 999px; background: color-mix(in srgb, var(--ttmt-primary) 10%, transparent); color: var(--ttmt-primary); font-size: .85rem; }
.ttmt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ttmt-card { overflow: hidden; border: 1px solid var(--ttmt-border); border-radius: 16px; background: var(--ttmt-surface); box-shadow: 0 8px 24px rgba(31, 49, 86, .06); }
.ttmt-image { display: grid; place-items: center; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: color-mix(in srgb, var(--ttmt-primary) 7%, var(--ttmt-bg)); }
.ttmt-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.ttmt-card:hover .ttmt-image img { transform: scale(1.025); }
.ttmt-image-placeholder .portal-icon { width: 44px; height: 44px; color: var(--ttmt-primary); }
.ttmt-card-body { padding: 18px; }
.ttmt-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--ttmt-muted); font-size: .8rem; }
.ttmt-topic { display: inline-block; padding: 5px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ttmt-primary) 9%, transparent); color: var(--ttmt-primary); font-size: .75rem; font-weight: 800; }
.ttmt-card h2 { margin: 10px 0; font-size: 1.1rem; line-height: 1.4; }
.ttmt-card h2 a { color: var(--ttmt-text); text-decoration: none; }
.ttmt-card h2 a:hover { color: var(--ttmt-primary); text-decoration: underline; }
.ttmt-card p { color: var(--ttmt-muted); line-height: 1.6; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.ttmt-read { color: var(--ttmt-primary); font-weight: 800; }
.ttmt-article-sources { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ttmt-card .ttmt-article-sources { justify-content: flex-start; margin-top: 14px; }
.ttmt-article-sources a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--ttmt-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ttmt-primary) 5%, var(--ttmt-surface));
  color: var(--ttmt-primary);
  font-size: .8rem;
  font-weight: 750;
  text-decoration: none;
}
.ttmt-article-sources a:hover { border-color: var(--ttmt-primary); text-decoration: underline; }
.ttmt-empty { margin-top: 22px; padding: 52px 24px; text-align: center; border: 1px dashed var(--ttmt-border); border-radius: 16px; background: var(--ttmt-surface); }
.ttmt-empty .portal-icon { width: 42px; height: 42px; color: var(--ttmt-primary); }
.ttmt-empty p { color: var(--ttmt-muted); }
.ttmt-alert { margin-top: 18px; padding: 14px 16px; border: 1px solid #9ab8e8; border-radius: 12px; background: #eef5ff; color: #173f79; }
.ttmt-alert-error { border-color: #f0a6a0; background: #fff1f0; color: var(--ttmt-danger); }
.ttmt-alert-success { border-color: #75c7a3; background: #ecfdf3; color: var(--ttmt-success); }
.ttmt-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.ttmt-kpis > div { padding: 17px; border: 1px solid var(--ttmt-border); border-radius: 14px; background: var(--ttmt-surface); }
.ttmt-kpis span { color: var(--ttmt-muted); font-size: .85rem; }
.ttmt-kpis strong { display: block; margin-top: 4px; color: var(--ttmt-primary); font-size: 1.8rem; }
.ttmt-kpis .is-danger strong { color: var(--ttmt-danger); }
.ttmt-tabs { display: flex; gap: 8px; margin-top: 22px; padding-bottom: 2px; overflow-x: auto; }
.ttmt-tabs a { box-sizing: border-box; min-height: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border: 1px solid var(--ttmt-border); border-radius: 10px; background: var(--ttmt-surface); color: var(--ttmt-text); font-weight: 750; text-decoration: none; white-space: nowrap; }
.ttmt-tabs a.is-active { border-color: var(--ttmt-primary); background: var(--ttmt-primary); color: #fff; }
.ttmt-admin .ttmt-hero {
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
}
.ttmt-admin .ttmt-hero > div:first-child {
  min-width: 0;
  flex: 1 1 620px;
}
.ttmt-admin .ttmt-hero h1 {
  margin: 3px 0 7px;
  font-size: clamp(1.65rem, 2.5vw, 2.15rem);
  line-height: 1.15;
}
.ttmt-admin .ttmt-hero p:not(.ttmt-eyebrow) {
  max-width: 700px;
  font-size: .94rem;
  line-height: 1.5;
}
.ttmt-admin .ttmt-hero-actions {
  flex: 0 1 520px;
  justify-content: flex-end;
  gap: 8px;
}
.ttmt-admin .ttmt-hero-actions .ttmt-button {
  padding: 7px 13px;
  font-size: .88rem;
  white-space: nowrap;
}
.ttmt-admin .ttmt-kpis {
  gap: 12px;
  margin-top: 18px;
}
.ttmt-admin .ttmt-kpis > div { padding: 14px 16px; }
.ttmt-admin .ttmt-kpis strong { font-size: 1.55rem; }
.ttmt-admin .ttmt-tabs {
  gap: 7px;
  margin-top: 18px;
}
.ttmt-admin .ttmt-tabs a {
  padding: 7px 13px;
  font-size: .9rem;
}
.ttmt-source-layout { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(0, 1.5fr); gap: 20px; align-items: start; }
.ttmt-source-form { display: grid; gap: 14px; position: sticky; top: 86px; }
.ttmt-source-form h2, .ttmt-panel h2 { margin: 0 0 6px; }
.ttmt-check { min-height: 44px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ttmt-check input { width: 20px; height: 20px; }
.ttmt-source-list article { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--ttmt-border); }
.ttmt-source-list h3 { margin: 0 0 6px; }
.ttmt-source-list a { color: var(--ttmt-primary); overflow-wrap: anywhere; }
.ttmt-source-list p { margin: 7px 0 0; color: var(--ttmt-muted); }
.ttmt-source-error { color: var(--ttmt-danger) !important; }
.ttmt-review-list { display: grid; gap: 16px; }
.ttmt-review-card { display: grid; gap: 14px; }
.ttmt-review-card.is-selected {
  border-color: var(--ttmt-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ttmt-primary) 12%, transparent);
}
.ttmt-review-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.ttmt-review-head time { margin-left: 10px; color: var(--ttmt-muted); font-size: .82rem; }
.ttmt-review-head a { color: var(--ttmt-primary); font-weight: 700; }
.ttmt-review-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ttmt-item-select {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--ttmt-border);
  border-radius: 9px;
  color: var(--ttmt-text);
  font-size: .82rem;
  font-weight: 750;
  cursor: pointer;
}
.ttmt-item-select:has(input:checked) { border-color: var(--ttmt-primary); color: var(--ttmt-primary); }
.ttmt-item-select input, .ttmt-bulk-toolbar input { width: 20px; height: 20px; accent-color: var(--ttmt-primary); }
.ttmt-item-select input:focus-visible, .ttmt-bulk-toolbar input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ttmt-primary) 30%, transparent);
  outline-offset: 2px;
}
.ttmt-review-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
.ttmt-review-actions { justify-content: flex-end; }
.ttmt-panel-heading { display: flex; justify-content: space-between; gap: 16px; }
.ttmt-panel-heading p { margin: 6px 0 0; color: var(--ttmt-muted); line-height: 1.55; }
.ttmt-create-form { display: grid; gap: 18px; margin-top: 18px; }
.ttmt-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ttmt-field-wide { grid-column: 1 / -1; }
.ttmt-field small { color: var(--ttmt-muted); font-size: .78rem; font-weight: 500; line-height: 1.45; }
.ttmt-manual-preview {
  display: grid;
  place-items: center;
  min-height: 80px;
  border: 1px dashed var(--ttmt-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ttmt-primary) 3%, var(--ttmt-surface));
}
.ttmt-manual-preview:has(img[hidden]) { display: none; }
.ttmt-manual-preview img {
  width: min(100%, 560px);
  max-height: 315px;
  border-radius: 10px;
  object-fit: cover;
}
.ttmt-image-editor {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--ttmt-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ttmt-primary) 3%, var(--ttmt-surface));
}
.ttmt-image-editor:has(img[hidden]) { grid-template-columns: 1fr; }
.ttmt-image-editor img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  object-fit: cover;
}
.ttmt-refilter { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.ttmt-refilter p { margin: 0; color: var(--ttmt-muted); }
.ttmt-bulk-toolbar {
  position: sticky;
  top: 72px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(31, 49, 86, .08);
}
.ttmt-bulk-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.ttmt-bulk-selection .ttmt-check { min-height: 36px; }
#ttmtBulkSelectionStatus { color: var(--ttmt-muted); font-size: .86rem; }

@media (max-width: 1180px) {
  .ttmt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttmt-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttmt-field-search { grid-column: 1 / -1; }
  .ttmt-source-layout { grid-template-columns: 1fr; }
  .ttmt-source-form { position: static; }
  .ttmt-image-editor { grid-template-columns: minmax(160px, 220px) minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .ttmt-admin .ttmt-hero { align-items: stretch; flex-direction: column; }
  .ttmt-admin .ttmt-hero > div:first-child,
  .ttmt-admin .ttmt-hero-actions { flex-basis: auto; max-width: none; }
  .ttmt-admin .ttmt-hero-actions { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .ttmt-page {
    width: min(100% - 24px, 1280px);
    padding-top: 18px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
  .ttmt-hero { align-items: stretch; flex-direction: column; padding: 20px; }
  .ttmt-hero-actions .ttmt-button { flex: 1 1 100%; }
  .ttmt-hero-actions .ttmt-action-form { width: 100%; }
  .ttmt-hero-actions .ttmt-action-form .ttmt-button { width: 100%; }
  .ttmt-grid, .ttmt-filters, .ttmt-kpis, .ttmt-review-grid, .ttmt-form-grid, .ttmt-image-editor { grid-template-columns: 1fr; }
  .ttmt-field-wide { grid-column: auto; }
  .ttmt-field-search { grid-column: auto; }
  .ttmt-kpis { grid-template-columns: repeat(2, 1fr); }
  .ttmt-filter-actions, .ttmt-review-actions { justify-content: stretch; }
  .ttmt-filter-actions > *, .ttmt-review-actions > * { flex: 1 1 100%; }
  .ttmt-refilter, .ttmt-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .ttmt-bulk-toolbar { position: static; }
  .ttmt-bulk-toolbar .ttmt-button { width: 100%; }
  .ttmt-source-list article, .ttmt-review-head, .ttmt-panel-heading { align-items: stretch; flex-direction: column; }
  .ttmt-article-sources a,
  .ttmt-item-select {
    min-height: 44px;
  }
  .ttmt-card h2 a,
  .ttmt-read,
  .ttmt-source-list h3 a,
  .ttmt-review-head a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ttmt-button, .ttmt-image img { transition: none; }
}
