/* Historial Operativo AXIS: línea de tiempo mobile-first. */
.card--history,
.card--history #history-list{
  min-width:0;
}

.card--history .history-dashboard{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:5px;
  margin-bottom:9px;
}

body.surface-white .card--history .history-kpi,
.card--history .history-kpi{
  min-width:0;
  padding:7px 4px;
  border:1px solid rgba(74,163,255,.43);
  border-radius:9px;
  background:
    linear-gradient(115deg,rgba(52,189,245,.09),transparent 55%),
    linear-gradient(180deg,rgba(252,254,255,.94),rgba(211,230,246,.8));
  box-shadow:inset 0 1px 0 #fff,0 7px 14px rgba(31,101,170,.08);
  text-align:center;
}

.card--history .history-kpi span{
  display:block;
  margin-bottom:4px;
  overflow-wrap:anywhere;
  color:#355572;
  font-size:7px;
  font-weight:900;
  line-height:1.1;
  text-transform:uppercase;
}

.card--history .history-kpi strong{
  display:block;
  color:#06182e;
  font-size:20px;
  line-height:1;
}

.card--history .history-tree.history-timeline{
  position:relative;
  display:grid;
  gap:7px;
  min-width:0;
  padding-left:8px;
}

.card--history .history-timeline::before,
.card--history .history-children::before,
.card--history .history-days::before{
  content:"";
  position:absolute;
  top:0;
  bottom:0;
  left:1px;
  width:1px;
  background:linear-gradient(180deg,rgba(52,189,245,.8),rgba(128,108,255,.52),rgba(52,189,245,.18));
  box-shadow:0 0 7px rgba(52,189,245,.34);
}

body.surface-white .card--history .history-period,
.card--history .history-period{
  position:relative;
  min-width:0;
  margin:0;
  overflow:visible;
  border:0;
  border-radius:10px;
  background:rgba(247,251,255,.56);
  box-shadow:inset 0 0 0 1px rgba(22,119,255,.13);
}

.card--history .history-period > summary{
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr) 28px;
  align-items:start;
  gap:5px;
  min-width:0;
  padding:8px 6px 8px 10px;
  list-style:none;
  cursor:pointer;
}

.card--history .history-period > summary::-webkit-details-marker{display:none}

.card--history .history-node{
  position:absolute;
  top:15px;
  left:-10px;
  width:7px;
  height:7px;
  border:1px solid #dff7ff;
  border-radius:50%;
  background:#34bdf5;
  box-shadow:0 0 0 3px #d9eaf6,0 0 8px rgba(52,189,245,.66);
}

.card--history .history-period-copy{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:2px 5px;
  min-width:0;
  text-align:left;
}

.card--history .history-period-eyebrow{
  grid-column:1;
  color:#0968aa;
  font-size:7px;
  font-weight:950;
  letter-spacing:.08em;
  line-height:1;
  text-transform:uppercase;
}

.card--history .history-period-copy > strong{
  grid-column:1;
  min-width:0;
  overflow-wrap:anywhere;
  color:#06182e;
  font-size:11px;
  line-height:1.08;
}

.card--history .history-period-score{
  grid-column:2;
  grid-row:1 / span 2;
  align-self:center;
  color:#075d9f;
  font-size:9px;
  font-weight:950;
  white-space:nowrap;
}

.card--history .history-period-detail{
  grid-column:1 / -1;
  min-width:0;
  overflow-wrap:anywhere;
  color:#355572;
  font-size:7.5px;
  font-weight:750;
  line-height:1.22;
}

.card--history .history-progress-row{
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:5px;
  min-width:0;
  margin-top:3px;
}

.card--history .history-progress{
  position:relative;
  display:block;
  height:5px;
  overflow:hidden;
  border:1px solid rgba(32,96,150,.2);
  border-radius:999px;
  background:rgba(68,99,126,.16);
  box-shadow:inset 0 1px 2px rgba(4,25,45,.13);
}

.card--history .history-progress-fill{
  display:block;
  width:var(--history-progress);
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,#da304b,#ff6a54);
  box-shadow:0 0 6px rgba(218,48,75,.28);
}

.card--history .history-progress.is-medium .history-progress-fill{
  background:linear-gradient(90deg,#e28a00,#ffc44c);
  box-shadow:0 0 6px rgba(226,138,0,.28);
}

.card--history .history-progress.is-high .history-progress-fill{
  background:linear-gradient(90deg,#0a9e67,#39d99f);
  box-shadow:0 0 6px rgba(10,158,103,.28);
}

.card--history .history-progress-state{
  color:#c3273f;
  font-size:6.5px;
  font-weight:950;
  white-space:nowrap;
}

.card--history .history-progress.is-medium + .history-progress-state{color:#a85f00}
.card--history .history-progress.is-high + .history-progress-state{color:#08734f}

.card--history .history-period-actions{
  position:relative;
  z-index:5;
  display:block;
}

.card--history .history-more{
  width:28px;
  height:27px;
  min-width:28px;
  min-height:27px;
  padding:0 0 5px;
  border:1px solid rgba(22,119,255,.34);
  border-radius:8px;
  color:#075d9f;
  background:linear-gradient(180deg,#fff,#d9ebf8);
  box-shadow:inset 0 1px 0 #fff;
  font-size:13px;
  font-weight:950;
  line-height:1;
}

.card--history .history-action-menu{
  position:absolute;
  top:30px;
  right:0;
  z-index:30;
  width:min(145px,calc(100vw - 24px));
  padding:4px;
  border:1px solid rgba(22,119,255,.48);
  border-radius:9px;
  background:linear-gradient(180deg,#f9fcff,#dcecf8);
  box-shadow:0 12px 26px rgba(10,45,76,.24),inset 0 1px 0 #fff;
}

.card--history .history-action-menu[hidden]{display:none}

.card--history .history-action-menu button{
  width:100%;
  min-height:30px;
  border:1px solid rgba(195,39,63,.4);
  border-radius:7px;
  padding:6px;
  color:#a71930;
  background:#fff1f4;
  font-size:8px;
  font-weight:900;
}

.card--history .history-children,
.card--history .history-days{
  position:relative;
  display:grid;
  gap:6px;
  min-width:0;
  margin:0 5px 6px 7px;
  padding-left:8px;
}

body.surface-white .card--history .history-month,
.card--history .history-month{background:rgba(240,248,255,.55)}

body.surface-white .card--history .history-week,
.card--history .history-week{background:rgba(245,252,255,.62)}

.card--history .history-year > summary .history-node{background:#806cff}
.card--history .history-month > summary .history-node{background:#1677ff}
.card--history .history-week > summary .history-node{background:#0c9e67}

.card--history .history-days{padding-top:1px}

body.surface-white .card--history .history-item,
.card--history .history-item{
  position:relative;
  display:grid;
  grid-template-columns:1fr;
  gap:6px;
  min-width:0;
  margin:0;
  padding:7px 5px 7px 7px;
  border:0;
  border-left:2px solid #c3273f;
  border-radius:8px;
  background:linear-gradient(180deg,rgba(255,255,255,.88),rgba(225,239,250,.76));
  box-shadow:inset 0 0 0 1px rgba(74,163,255,.2);
}

.card--history .history-item.is-medium{border-left-color:#e28a00}
.card--history .history-item.is-high{border-left-color:#0a9e67}
.card--history .history-item.is-missing{border-left-color:#df314b}
.card--history .history-item.is-pending{border-left-color:#38bdf8}
.card--history .history-item.is-missing .history-actions{
  grid-template-columns:30px minmax(0,1fr);
  align-items:center;
  justify-content:end;
  justify-self:end;
  width:min(100%,210px);
  gap:7px;
}

.card--history .history-note-indicator{
  cursor:pointer;
  padding:0;
  appearance:none;
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  border:1px solid currentColor;
  border-radius:50%;
  background:rgba(8,24,43,.96);
  transition:transform .18s ease,filter .18s ease,box-shadow .18s ease;
}

.card--history .history-note-indicator svg{
  width:15px;
  height:15px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.card--history .history-note-indicator.has-note{
  color:#20d986;
  box-shadow:0 0 0 2px rgba(32,217,134,.12),0 0 12px rgba(32,217,134,.52),inset 0 0 9px rgba(32,217,134,.12);
}

.card--history .history-note-indicator.is-empty{
  color:#ff4964;
  box-shadow:0 0 0 2px rgba(255,73,100,.1),0 0 10px rgba(255,73,100,.42),inset 0 0 8px rgba(255,73,100,.1);
}

.card--history .history-node--day{
  top:13px;
  left:-13px;
  width:6px;
  height:6px;
  background:#fff;
}

.card--history .history-day-main{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content;
  align-items:center;
  gap:7px;
  min-width:0;
  text-align:left;
}

.card--history .history-day-main strong{
  color:#06182e;
  font-size:8px;
  font-weight:950;
  line-height:1.1;
  white-space:nowrap;
}

.card--history .history-score{
  color:#075d9f;
  font-size:6.5px;
  font-weight:950;
  line-height:1.1;
  text-align:right;
  white-space:nowrap;
}

.card--history .history-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:5px;
}

.card--history .history-actions button{
  min-width:0;
  min-height:30px;
  border-radius:8px;
  padding:5px 2px;
  font-size:7px;
  font-weight:900;
  line-height:1;
  white-space:nowrap;
}

.card--history .history-actions .btn-open{
  border:1px solid rgba(22,119,255,.5);
  color:#fff;
  background:linear-gradient(180deg,#42a5ff,#1677ff);
  box-shadow:0 5px 10px rgba(22,119,255,.15);
}

.card--history .history-missing-detail{
  grid-column:1 / -1;
  display:grid;
  gap:7px;
  min-width:0;
  padding:9px;
  border:1px solid rgba(223,49,75,.34);
  border-radius:8px;
  background:linear-gradient(180deg,rgba(255,247,249,.96),rgba(248,228,233,.82));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.84);
}

.card--history .history-missing-detail[hidden]{display:none}

.card--history .history-note-heading{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:#8f182d;
  font-size:9px;
  text-align:center;
}

.card--history .history-note-view p{
  margin:0;
  padding:6px 8px;
  border:1px solid rgba(22,119,255,.18);
  border-radius:7px;
  color:#273e55;
  background:rgba(255,255,255,.58);
  font-size:11px;
  font-weight:700;
  line-height:1.3;
  overflow-wrap:anywhere;
}

.card--history .history-note-view p.is-empty{color:#6d7f90;font-style:italic}

.card--history .history-note-editor{
  width:100%;
  height:44px;
  min-height:44px;
  max-height:120px;
  field-sizing:content;
  resize:vertical;
  border:1px solid rgba(22,119,255,.42);
  border-radius:7px;
  padding:5px 8px;
  color:#10263a;
  background:rgba(255,255,255,.9);
  font:inherit;
  font-size:11px;
  font-weight:700;
  line-height:1.25;
  text-align:center;
}

.card--history .history-note-editor[hidden]{display:none}
.card--history .history-note-editor::placeholder{font-weight:400}

.card--history .history-note-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:5px;
}

.card--history .history-note-actions button{
  flex:0 1 108px;
  width:108px;
  min-width:82px;
  min-height:29px;
  padding:5px;
  border:1px solid rgba(22,119,255,.38);
  border-radius:7px;
  color:#075d9f;
  background:linear-gradient(180deg,#fff,#dcecf8);
  font-size:8px;
  font-weight:900;
}

.card--history .history-note-actions button[hidden]{display:none}
.card--history .history-note-actions [data-action="save-missing-note"]{
  border-color:rgba(22,119,255,.72);
  color:#fff;
  background:linear-gradient(180deg,#42a5ff,#1677ff);
  box-shadow:0 5px 12px rgba(22,119,255,.2);
}
.card--history .history-note-actions [data-action="cancel-missing-note"]{
  border-color:rgba(91,115,136,.32);
  color:#425b70;
  background:linear-gradient(180deg,#f9fbfd,#dfe8ef);
  box-shadow:none;
}

body.surface-white .card--history .history-actions .btn-delete,
.card--history .history-actions .btn-delete{
  border:1px solid rgba(195,39,63,.45);
  color:#a71930;
  background:linear-gradient(180deg,#fff8fa,#f5dce2);
}

.card--history .history-empty{
  margin:0;
  padding:18px 8px;
  color:#355572;
  font-size:10px;
  font-weight:850;
  text-align:center;
}

.card--history :focus-visible{
  outline:2px solid #0b85d8;
  outline-offset:2px;
}

/* MODO OSCURO */
body:not(.surface-white) .card--history .history-kpi{
  border-color:rgba(77,174,255,.5);
  background:
    radial-gradient(circle at 50% 0%,rgba(52,189,245,.16),transparent 62%),
    linear-gradient(180deg,rgba(16,37,58,.96),rgba(5,19,34,.98));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 0 0 1px rgba(52,189,245,.06),
    0 8px 18px rgba(0,0,0,.22);
}

body:not(.surface-white) .card--history .history-kpi span{
  color:#b9dcf7;
  text-shadow:0 1px 3px rgba(0,0,0,.7);
}

body:not(.surface-white) .card--history .history-kpi strong{
  color:#f5fbff;
  text-shadow:0 0 9px rgba(52,189,245,.48);
}

body:not(.surface-white) .card--history .history-period,
body:not(.surface-white) .card--history .history-month,
body:not(.surface-white) .card--history .history-week{
  background:
    linear-gradient(135deg,rgba(24,52,76,.92),rgba(8,24,40,.96));
  box-shadow:
    inset 0 0 0 1px rgba(74,163,255,.26),
    0 8px 18px rgba(0,0,0,.16);
}

body:not(.surface-white) .card--history .history-period-eyebrow{
  color:#67caff;
}

body:not(.surface-white) .card--history .history-period-copy > strong,
body:not(.surface-white) .card--history .history-day-main strong{
  color:#f4f9ff;
  text-shadow:0 1px 3px rgba(0,0,0,.66);
}

body:not(.surface-white) .card--history .history-period-score,
body:not(.surface-white) .card--history .history-score{
  color:#5fd0ff;
  text-shadow:0 0 7px rgba(52,189,245,.3);
}

body:not(.surface-white) .card--history .history-period-detail{
  color:#c1d7e9;
}

body:not(.surface-white) .card--history .history-progress{
  border-color:rgba(120,193,255,.28);
  background:rgba(2,13,25,.62);
  box-shadow:inset 0 1px 3px rgba(0,0,0,.5);
}

body:not(.surface-white) .card--history .history-progress-state{
  color:#ff8798;
}

body:not(.surface-white) .card--history .history-progress.is-medium + .history-progress-state{
  color:#ffd071;
}

body:not(.surface-white) .card--history .history-progress.is-high + .history-progress-state{
  color:#63e6b4;
}

body:not(.surface-white) .card--history .history-more{
  border-color:rgba(77,174,255,.62);
  color:#d9f2ff;
  background:linear-gradient(180deg,rgba(25,66,99,.98),rgba(7,27,45,.98));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 0 10px rgba(52,189,245,.13);
}

body:not(.surface-white) .card--history .history-action-menu{
  border-color:rgba(77,174,255,.58);
  background:linear-gradient(180deg,#102f49,#071b2d);
  box-shadow:0 14px 28px rgba(0,0,0,.42),inset 0 1px 0 rgba(255,255,255,.08);
}

body:not(.surface-white) .card--history .history-action-menu button,
body:not(.surface-white) .card--history .history-actions .btn-delete{
  border-color:rgba(255,103,126,.56);
  color:#ffd5dc;
  background:linear-gradient(180deg,rgba(111,26,45,.94),rgba(63,13,28,.96));
}

body:not(.surface-white) .card--history .history-item{
  background:
    linear-gradient(135deg,rgba(19,45,67,.95),rgba(7,23,38,.97));
  box-shadow:inset 0 0 0 1px rgba(74,163,255,.26);
}

body:not(.surface-white) .card--history .history-missing-detail{
  border-color:rgba(255,103,126,.48);
  background:linear-gradient(180deg,rgba(75,20,35,.94),rgba(36,11,23,.97));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06);
}

body:not(.surface-white) .card--history .history-note-heading{color:#ffe4e9}
body:not(.surface-white) .card--history .history-note-view p{
  border-color:rgba(255,103,126,.24);
  color:#fff4f6;
  background:rgba(9,20,32,.46);
}
body:not(.surface-white) .card--history .history-note-view p.is-empty{color:#d0a8b1}
body:not(.surface-white) .card--history .history-note-editor{
  border-color:rgba(255,103,126,.46);
  color:#fff;
  background:rgba(9,20,32,.88);
}

body:not(.surface-white) .card--history .history-empty{
  color:#c1d7e9;
}

/* MOBILE */
@media (min-width:371px){
  .card--history .history-dashboard{gap:8px;margin-bottom:12px}
  body.surface-white .card--history .history-kpi,
  .card--history .history-kpi{padding:10px 7px;border-radius:12px}
  .card--history .history-kpi span{font-size:8px}
  .card--history .history-kpi strong{font-size:24px}
  .card--history .history-tree.history-timeline{gap:10px;padding-left:11px}
  .card--history .history-period > summary{grid-template-columns:minmax(0,1fr) 34px;padding:11px 9px 11px 13px}
  .card--history .history-node{left:-13px;width:8px;height:8px}
  .card--history .history-period-eyebrow{font-size:8px}
  .card--history .history-period-copy > strong{font-size:14px}
  .card--history .history-period-score{font-size:11px}
  .card--history .history-period-detail{font-size:9.5px}
  .card--history .history-progress{height:7px}
  .card--history .history-progress-state{font-size:8px}
  .card--history .history-more{width:32px;height:30px}
  .card--history .history-action-menu{top:34px;width:164px}
  .card--history .history-action-menu button{font-size:10px}
  .card--history .history-children,
  .card--history .history-days{gap:8px;margin:0 8px 9px 10px;padding-left:11px}
  body.surface-white .card--history .history-item,
  .card--history .history-item{gap:8px;padding:10px}
  .card--history .history-node--day{left:-16px}
  .card--history .history-day-main strong{font-size:11px}
  .card--history .history-score{font-size:10px}
  .card--history .history-actions button{min-height:34px;font-size:10px}
}

/* TABLET */
@media (min-width:768px){
  .card--history .history-dashboard{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
  body.surface-white .card--history .history-kpi,
  .card--history .history-kpi{padding:13px 8px}
  .card--history .history-kpi strong{font-size:28px}
  .card--history .history-period > summary{padding:13px 12px 13px 16px}
  .card--history .history-period-copy > strong{font-size:16px}
  .card--history .history-period-detail{font-size:10.5px}
  body.surface-white .card--history .history-item,
  .card--history .history-item{grid-template-columns:minmax(0,1fr) 180px;align-items:center}
  .card--history .history-item.is-missing{grid-template-columns:minmax(0,1fr) 168px}
  .card--history .history-actions button{min-height:38px}
  .card--history .history-item.is-missing .history-actions{grid-template-columns:34px minmax(0,1fr);gap:8px}
  .card--history .history-note-indicator{width:32px;height:32px}
}

/* ORDENADOR */
@media (min-width:1024px){
  .card--history .history-tree.history-timeline{gap:12px}
  .card--history .history-period > summary{padding:15px 14px 15px 18px}
  .card--history .history-children,
  .card--history .history-days{margin-right:12px;margin-bottom:12px}
}

@media (hover:hover){
  .card--history .history-more:hover{border-color:#36bdf6;box-shadow:0 0 10px rgba(52,189,245,.2)}
  .card--history .history-period > summary:hover{background:rgba(74,163,255,.055)}
  .card--history .history-actions .btn-open:hover{filter:brightness(1.07)}
  .card--history .history-actions .btn-delete:hover,
  .card--history .history-action-menu button:hover{border-color:rgba(195,39,63,.68);background:#ffe8ed}
  .card--history .history-note-indicator:hover{transform:scale(1.05);filter:brightness(1.1)}
}

@media (prefers-reduced-motion:reduce){
  .card--history *,
  .card--history *::before,
  .card--history *::after{
    scroll-behavior:auto !important;
    transition-duration:.01ms !important;
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
  }
}

.card--history .history-note-indicator:focus-visible{outline:2px solid #59c7ff;outline-offset:4px}

.card--history .history-actions button.history-note-indicator{min-height:28px;padding:0;border-radius:50%}
@media (hover:none) and (pointer:coarse){.card--history .history-actions button.history-note-indicator{min-height:32px}}

/* iOS zooms focused inputs smaller than 16px; keep note controls at native scale. */
@media (hover:none) and (pointer:coarse){
  .card--history .history-note-editor{font-size:16px}
}
.card--history .axis-voice-field:has(> .history-note-editor[hidden]){display:none}

/* Center against the textarea box, without the inline text baseline gap. */
.card--history .axis-voice-field:has(> .history-note-editor){line-height:0}
.card--history .axis-voice-field > .history-note-editor{display:block;margin:0;box-sizing:border-box}
.card--history .axis-voice-field > .history-note-editor[hidden]{display:none}
.card--history .history-note-editor + .axis-voice-button{top:50% !important;bottom:auto !important;transform:translateY(-50%)}
