/* Authority Planer CSS Theme
 * Top layer for theme-level tokens and gentle visual tuning.
 */

/* Module v7: global heading + spacing refinement */
:root{
  --space-block-xs: .45rem;
  --space-block-sm: .8rem;
  --space-block-md: 1.15rem;
  --space-block-lg: 1.65rem;
  --space-block-xl: 2.35rem;
  --heading-1: clamp(1.85rem, 1.35rem + 1.6vw, 2.45rem);
  --heading-2: clamp(1.35rem, 1.1rem + .8vw, 1.8rem);
  --heading-3: clamp(1.05rem, .95rem + .45vw, 1.28rem);
}

h1,h2,h3{
  letter-spacing:-.03em;
  color:var(--primary-strong);
}

h1{font-size:var(--heading-1);line-height:1.08}
h2{font-size:var(--heading-2);line-height:1.16}
h3{font-size:var(--heading-3);line-height:1.22}

.page-head{
  margin-bottom:clamp(1.4rem, 1.15rem + .8vw, 2rem);
}
.page-head > div > .eyebrow{margin-bottom:10px}
.page-head h1{
  margin:0 0 .45rem;
  font-size:var(--heading-1);
}
.page-head .muted,
.page-head .table-sub{
  margin-top:0;
  max-width:72ch;
}
.page-actions{gap:12px}

.card,
.task-card,
.task-mini-rich,
.stat-card,
.meta-card{
  padding:clamp(1rem, .9rem + .6vw, 1.45rem);
}

.table-head{
  gap:18px;
  margin-bottom:18px;
}
.table-head > div > .eyebrow{margin-bottom:8px}
.table-head h2,
.table-head h3,
.table-head strong{
  display:block;
  margin:0 0 .35rem;
}
.table-head .muted,
.table-head .table-sub{margin-top:0}

.task-stack{gap:22px}
.task-top{
  margin-bottom:16px;
  gap:18px;
}
.task-top h3{
  margin:0 0 .5rem;
  font-size:var(--heading-2);
}
.task-top .muted{margin:0}
.task-badges-row{gap:10px;margin-top:2px}
.task-grid{margin:20px 0 20px;gap:18px 20px}
.task-grid > div{padding:18px 18px 16px}

.meta-card .meta-label,
.detail-label,
.table th,
.sources-detail strong{
  margin-bottom:.5rem;
}
.meta-value + .table-sub,
.detail-text + .table-sub{margin-top:.45rem}

.form-grid{gap:20px}
label{gap:9px}
.field-title{
  margin:0 0 12px;
  font-size:1rem;
}
.actions-row{margin-top:4px}

.alert{margin-bottom:18px}
.alert + .card,
.alert + .table-wrap,
.alert + .stats-grid{margin-top:4px}

.filters-inline{gap:14px}
.filters-inline label{display:grid;gap:8px}

.table th,.table td{padding:17px 12px}
.table tbody tr:last-child td{border-bottom:0}

@media (max-width: 860px){
  .page-head{gap:14px}
  .card,
  .task-card,
  .task-mini-rich,
  .stat-card,
  .meta-card{padding:16px}
  .task-grid{gap:14px;margin:16px 0}
  .task-grid > div{padding:15px}
}

/* Module v8: addon/theme refinements on top of protected core */
@font-face{
  font-family:'AuthorityPlanerUI';
  src:url('../fonts/montserrat-v26-latin-regular.woff2') format('woff2');
  font-weight:400;
  font-style:normal;
  font-display:swap;
}
@font-face{
  font-family:'AuthorityPlanerUI';
  src:url('../fonts/montserrat-v26-latin-600.woff2') format('woff2');
  font-weight:600;
  font-style:normal;
  font-display:swap;
}
@font-face{
  font-family:'AuthorityPlanerUI';
  src:url('../fonts/montserrat-v26-latin-300.woff2') format('woff2');
  font-weight:300;
  font-style:normal;
  font-display:swap;
}

:root{
  --font-base:'AuthorityPlanerUI', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --priority-core:#2f5c8f;
  --priority-very-important:#3b7f9c;
  --priority-nice:#69a6a6;
  --priority-later:#b5b8c6;
  --priority-avoid:#b85c5c;
  --score-red:#c65252;
  --score-orange:#db8a3d;
  --score-yellow:#c4a83c;
  --score-lime:#8bb64b;
  --score-green:#4f9b73;
  --surface-soft:#f6f8fa;
  --surface-soft-2:#f1f5f7;
}

html,body,
button,input,select,textarea,
dialog,.card,.task-card,.task-mini-rich,.score-dialog,.page-head,.meta-card{
  font-family:var(--font-base) !important;
}

.card,.task-card,.task-mini-rich,.stat-card,.meta-card,.filter-card{
  box-shadow:0 8px 22px rgba(18,39,41,.045);
}

.badge-core{background:color-mix(in srgb, var(--priority-core) 18%, white);color:var(--priority-core);border:1px solid color-mix(in srgb, var(--priority-core) 28%, white)}
.badge-very_important{background:color-mix(in srgb, var(--priority-very-important) 18%, white);color:var(--priority-very-important);border:1px solid color-mix(in srgb, var(--priority-very-important) 28%, white)}
.badge-nice_to_have{background:color-mix(in srgb, var(--priority-nice) 18%, white);color:var(--priority-nice);border:1px solid color-mix(in srgb, var(--priority-nice) 28%, white)}
.badge-later{background:color-mix(in srgb, var(--priority-later) 26%, white);color:#6c7389;border:1px solid color-mix(in srgb, var(--priority-later) 38%, white)}
.badge-avoid{background:color-mix(in srgb, var(--priority-avoid) 16%, white);color:var(--priority-avoid);border:1px solid color-mix(in srgb, var(--priority-avoid) 30%, white)}

/* project form: calmer grouped sections */
.page-head + .card > form.form-grid.two-col{
  gap:20px 20px;
}
.page-head + .card > form.form-grid.two-col > label,
.page-head + .card > form.form-grid.two-col > .full-width{
  align-self:start;
}
.page-head + .card > form.form-grid.two-col > label{
  background:linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(250,252,253,.96) 100%);
  border:1px solid var(--line);
  border-radius:20px;
  padding:16px 16px 14px;
  box-shadow:0 6px 18px rgba(18,39,41,.035);
}
.page-head + .card > form.form-grid.two-col > .full-width{
  background:linear-gradient(180deg, var(--surface-soft) 0%, #fff 100%);
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px 18px 16px;
}
.page-head + .card > form.form-grid.two-col > .full-width.checkbox-grid{
  background:transparent;
  border:none;
  padding:0;
  box-shadow:none;
}
.page-head + .card > form.form-grid.two-col .field-title{
  font-size:1.02rem;
  font-weight:800;
  margin:0 0 12px;
}
.page-head + .card > form.form-grid.two-col .checkbox-grid{
  gap:12px 12px;
}
.page-head + .card > form.form-grid.two-col .checkbox{
  min-height:56px;
  align-items:center;
  border-radius:16px;
  background:var(--panel-soft);
}
.page-head + .card > form.form-grid.two-col .target-row{
  grid-template-columns:minmax(220px,1fr) minmax(320px,2fr) auto;
  gap:12px;
  align-items:center;
}
.page-head + .card > form.form-grid.two-col .top-space-sm{margin-top:12px}
.page-head + .card > form.form-grid.two-col textarea{min-height:120px}
.page-head + .card > form.form-grid.two-col .actions-row.full-width{
  padding:0;
  background:none;
  border:none;
  justify-content:flex-start;
}

/* source/industry cards: meta data in clearer boxes */
.task-mini-rich,
.card.task-card{
  background:linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
}
.task-mini-rich .mini-meta,
.card.task-card .task-grid > div,
.card.task-card .task-grid > div p,
.card.task-card .task-grid > div .detail-text{
  line-height:1.55;
}
.task-mini-rich .mini-meta{
  background:var(--surface-soft);
  border:1px solid var(--line);
  border-radius:16px;
  padding:13px 14px;
}
.task-mini-rich .mini-meta + .mini-meta{margin-top:10px}
.task-mini-rich p{margin:0 0 14px}
.task-mini-rich h3{margin:8px 0 10px}
.task-grid > div{
  background:var(--surface-soft);
  border:1px solid var(--line);
  border-radius:16px;
}

/* score modal: modern, consistent, left red -> right green */
.score-dialog{
  width:min(820px,92vw);
  border-radius:26px;
  background:#fff;
}
.score-dialog .dialog-head{
  padding:18px 22px;
  border-bottom:1px solid var(--line);
}
.score-dialog .dialog-head h3{
  font-size:1.18rem;
  letter-spacing:-.025em;
}
.score-dialog .dialog-close{
  width:36px;
  height:36px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--surface-soft);
  color:var(--primary-strong);
}
.score-breakdown{
  padding:20px 22px 22px;
  gap:12px;
}
.score-row{
  grid-template-columns:220px 1fr 64px;
  gap:16px;
  padding:10px 0;
}
.score-row span{
  font-weight:700;
  letter-spacing:-.01em;
}
.score-bar{
  height:14px;
  background:#e7e2db;
  border-radius:999px;
  box-shadow:inset 0 1px 2px rgba(18,39,41,.08);
}
.score-bar-fill{
  position:relative;
  height:100%;
  border-radius:999px;
  box-shadow:0 1px 1px rgba(255,255,255,.22) inset;
}
.score-bar-fill::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 100%);
}
.score-value-text{
  text-align:right;
  font-weight:800;
  letter-spacing:-.02em;
}
.score-row.score10-bad .score-bar-fill{background:linear-gradient(90deg, color-mix(in srgb, var(--score-red) 75%, #f7d7d7) 0%, var(--score-red) 100%)}
.score-row.score10-weak .score-bar-fill{background:linear-gradient(90deg, color-mix(in srgb, var(--score-orange) 75%, #f4dfc7) 0%, var(--score-orange) 100%)}
.score-row.score10-ok .score-bar-fill{background:linear-gradient(90deg, color-mix(in srgb, var(--score-yellow) 75%, #efe4b8) 0%, var(--score-yellow) 100%)}
.score-row.score10-good .score-bar-fill{background:linear-gradient(90deg, color-mix(in srgb, var(--score-lime) 72%, #e3efc7) 0%, var(--score-lime) 100%)}
.score-row.score10-excellent .score-bar-fill{background:linear-gradient(90deg, color-mix(in srgb, var(--score-green) 72%, #d6ebdf) 0%, var(--score-green) 100%)}
.score-row.score10-bad .score-value-text{color:var(--score-red)}
.score-row.score10-weak .score-value-text{color:var(--score-orange)}
.score-row.score10-ok .score-value-text{color:#9b8222}
.score-row.score10-good .score-value-text{color:#6d8f2f}
.score-row.score10-excellent .score-value-text{color:var(--score-green)}

/* optional subtle row tint */
.score-row.score10-bad span{color:#5b2626}
.score-row.score10-weak span{color:#66411a}
.score-row.score10-ok span{color:#5e5320}
.score-row.score10-good span{color:#4a5f23}
.score-row.score10-excellent span{color:var(--primary-strong)}

@media (max-width: 980px){
  .page-head + .card > form.form-grid.two-col > label{
    padding:14px 14px 12px;
  }
  .page-head + .card > form.form-grid.two-col .target-row{
    grid-template-columns:1fr;
    align-items:stretch;
  }
}
@media (max-width: 860px){
  .score-dialog{
    width:min(96vw, 720px);
    border-radius:22px;
  }
  .score-breakdown{padding:16px}
  .score-row{
    grid-template-columns:1fr;
    gap:8px;
    padding:8px 0;
  }
  .score-value-text{text-align:left}
}

/* Module v11: global type hierarchy and calmer section spacing */
:root{
  --heading-1: clamp(2.15rem, 1.55rem + 1.8vw, 2.95rem);
  --heading-2: clamp(1.65rem, 1.2rem + 1vw, 2.1rem);
  --heading-3: clamp(1.18rem, 1rem + .45vw, 1.42rem);
  --section-gap-lg: clamp(1.45rem, 1.1rem + .9vw, 2.15rem);
}

.page-head{
  margin-bottom: var(--section-gap-lg);
}
.page-head h1{
  margin: 0 0 .55rem;
}
.page-head .muted,
.page-head .table-sub{
  font-size: 1rem;
  line-height: 1.55;
}

.section-head{
  margin-bottom: 1.2rem;
}
.section-head h2{
  margin: 0 0 .35rem;
  font-size: var(--heading-2);
}
.section-head .muted{
  display:block;
  font-size: 1rem;
  line-height: 1.55;
  max-width: 72ch;
}

.task-top h3,
.task-mini-rich h3,
.card.task-card h3{
  font-size: clamp(1.45rem, 1.15rem + .55vw, 1.9rem);
  line-height: 1.15;
}

@media (max-width: 860px){
  .page-head .muted,
  .section-head .muted{
    font-size: .96rem;
  }
}

/* Module v13: normalize global heading hierarchy back to system scale */
:root{
  --heading-1: clamp(1.95rem, 1.45rem + 1.45vw, 2.55rem);
  --heading-2: clamp(1.42rem, 1.14rem + .62vw, 1.82rem);
  --heading-3: clamp(1.12rem, 1rem + .28vw, 1.26rem);
  --heading-4: 1rem;
}

.page-head h1{
  font-size: var(--heading-1) !important;
}

h2,
.section-head h2,
.task-top h3,
.task-mini-rich h3,
.card.task-card h3{
  font-size: var(--heading-2) !important;
  line-height: 1.14 !important;
  letter-spacing: -.025em !important;
}

h3,
.source-info-box strong,
.task-grid > div strong,
.card.task-card .detail-label{
  font-size: var(--heading-3) !important;
  line-height: 1.2 !important;
}

h4{
  font-size: var(--heading-4) !important;
  line-height: 1.28 !important;
}

@media (max-width: 860px){
  :root{
    --heading-1: clamp(1.75rem, 1.35rem + 1vw, 2.1rem);
    --heading-2: clamp(1.28rem, 1.08rem + .45vw, 1.5rem);
    --heading-3: clamp(1.05rem, .98rem + .18vw, 1.14rem);
  }
}
