/* Mis Cosas · estilos */
:root {
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --ink: #15171C;
  --muted: #5B6170;
  --soft: #646A79;
  --line: #E3E5EA;
  --line2: #EEF0F3;
  --web: #2457C5; --web-bg: #E8EEFB; --web-dk: #1A3F91;
  --mae: #B4530A; --mae-bg: #FCEEE3; --mae-dk: #8A3E06;
  --ok: #157F3D; --ok-bg: #E6F4EA; --ok-dk: #105C2C;
  --bad: #B42318; --bad-bg: #FDECEA; --bad-dk: #912018;
  --idle-bg: #EEF0F3; --idle-dk: #454A57;
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: var(--web); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Estructura */
.wrap { max-width: 560px; margin: 0 auto; padding: calc(24px + var(--safe-t)) 20px calc(110px + var(--safe-b)); display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.head .kicker { font-size: 14px; font-weight: 700; color: var(--muted); }
.head h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.kicker.web { color: var(--web); } .kicker.mae { color: var(--mae-dk); }
h2 { font-size: 18px; font-weight: 700; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Barra inferior */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 8px 0 calc(8px + var(--safe-b)); z-index: 20; }
.tabs-in { width: 100%; max-width: 560px; display: flex; justify-content: space-around; }
.tab { position: relative; width: 76px; min-height: 48px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--soft); font-size: 12px; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab.mae[aria-current="page"] { color: var(--mae-dk); }
.tab.web[aria-current="page"] { color: var(--web); }
.tab .dot { position: absolute; top: -2px; left: 46px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.s { width: 18px; height: 18px; }

/* Tarjetas y listas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pad { padding: 16px; }
.list > * + * { border-top: 1px solid var(--line2); }
.row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; text-decoration: none; color: inherit; }
.row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .t { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.row .s { font-size: 13px; color: var(--muted); }
.empty { padding: 20px 16px; color: var(--muted); font-size: 14px; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--ink); cursor: pointer; text-align: left; }
.tile .ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.tile .name { font-size: 17px; font-weight: 700; }
.tile .s { font-size: 13px; color: var(--muted); }
.ico.web { background: var(--web-bg); color: var(--web); }
.ico.mae { background: var(--mae-bg); color: var(--mae-dk); }
.ico.sys { background: var(--idle-bg); color: var(--idle-dk); }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.led { width: 8px; height: 8px; border-radius: 4px; background: var(--ok); flex: none; }
.led.ko { background: var(--bad); } .led.off { background: #A0A5B1; }
.date { width: 48px; height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; background: var(--mae-bg); color: var(--mae-dk); }
.date b { font-size: 18px; font-weight: 800; line-height: 1; } .date span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.date.urgent { background: var(--bad-bg); color: var(--bad-dk); }

/* Pastillas y botones */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid #D5D8DE; background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 10px; white-space: nowrap; display: inline-block; }
.tag.ok { background: var(--ok-bg); color: var(--ok-dk); } .tag.warn { background: var(--mae-bg); color: var(--mae-dk); }
.tag.bad { background: var(--bad-bg); color: var(--bad-dk); } .tag.idle { background: var(--idle-bg); color: var(--idle-dk); }
.tag.solid { background: var(--mae); color: #fff; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.blue { background: var(--web); border-color: var(--web); color: #fff; }
.btn.orange { background: var(--mae); border-color: var(--mae); color: #fff; }
.btn.danger { color: var(--bad-dk); }
.btn.link { border: 0; background: none; color: var(--web); padding: 0 8px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn { position: relative; width: 48px; height: 48px; border-radius: 24px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Plazo destacado */
.plazo { background: var(--card); border: 2px solid var(--mae); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.plazo.proximo { border-color: var(--line); border-width: 1px; }
.plazo .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plazo .t { font-size: 18px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.bar { height: 8px; border-radius: 4px; background: #F1E3D6; overflow: hidden; }
.bar > div { height: 8px; background: var(--mae); }
.docs { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line2); padding-top: 12px; }
.docs label { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 32px; cursor: pointer; }
.docs input { width: 20px; height: 20px; accent-color: var(--mae); flex: none; }
.docs label.done span { color: var(--muted); text-decoration: line-through; }

/* Avisos */
.aviso { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.aviso .ico { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.aviso .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.aviso .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.aviso .meta b { font-weight: 700; text-transform: uppercase; }
.aviso .meta b.web { color: var(--web); } .aviso .meta b.mae { color: var(--mae-dk); } .aviso .meta b.sys { color: var(--idle-dk); }
.aviso .t { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.aviso .b { font-size: 13px; color: var(--muted); }
.aviso .acts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.aviso .acts .btn { min-height: 36px; font-size: 13px; padding: 0 10px; border-radius: 10px; }
.unread-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--web); margin-top: 4px; flex: none; }
.aviso.unread { background: #FBFCFF; }

/* Formularios */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form input:not([type=checkbox]), .form select, .form textarea { min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid #CDD1D8; background: #fff; font-weight: 500; width: 100%; }
.form textarea { min-height: 110px; resize: vertical; }
.form .hint { font-size: 12px; font-weight: 500; color: var(--muted); }
.form .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form .check { flex-direction: row; align-items: center; gap: 10px; }
.form .check input { width: 20px; height: 20px; }
.docs-edit { display: flex; flex-direction: column; gap: 8px; }
.docs-edit .line { display: flex; gap: 8px; }
.docs-edit .line input { flex: 1; }
.error { background: var(--bad-bg); color: var(--bad-dk); padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--idle-bg); padding: 8px 10px; border-radius: 10px; overflow-wrap: anywhere; user-select: all; }
pre.log { white-space: pre-wrap; font-size: 12px; background: var(--idle-bg); padding: 10px; border-radius: 10px; margin: 0; max-height: 240px; overflow: auto; }

/* Hoja modal */
.sheet-bg { position: fixed; inset: 0; background: rgba(21, 23, 28, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.sheet .sheet-head { display: flex; justify-content: space-between; align-items: center; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; } }

/* Aviso flotante */
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.18); }

/* Acceso e instalación */
.auth { max-width: 380px; margin: 0 auto; padding: 80px 24px; display: flex; flex-direction: column; gap: 18px; }
.auth h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checks .ok { color: var(--ok-dk); } .checks .ko { color: var(--bad-dk); font-weight: 700; }

.banner { background: var(--web-bg); color: var(--web-dk); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.banner.warn { background: var(--mae-bg); color: var(--mae-dk); }

/* Webs */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--ink); min-height: 44px; }
.cli { padding: 16px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; }
.cli.inactive { opacity: .6; }
.cli-top { display: flex; align-items: center; gap: 10px; }
.cli-top .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cli-top .t { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.cli-top .s { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cli-top svg { color: var(--soft); }
.cli-alert { background: var(--bad-bg); color: var(--bad-dk); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pill { border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pill span { font-size: 11px; font-weight: 700; color: var(--idle-dk); }
.pill b { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.ok { background: var(--ok-bg); } .pill.ok b { color: var(--ok-dk); }
.pill.warn { background: var(--mae-bg); } .pill.warn b { color: var(--mae-dk); }
.pill.bad { background: var(--bad-bg); } .pill.bad b { color: var(--bad-dk); }
.pill.idle { background: var(--idle-bg); } .pill.idle b { color: var(--idle-dk); }
.kvs { display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-items: baseline; font-size: 14px; }
.kv > span:first-child { color: var(--muted); font-weight: 600; }
.kv > b { font-weight: 600; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kv .kv-sub { grid-column: 2; font-size: 12px; }
.ups { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line2); padding-top: 12px; }
.up-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.up-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.up { color: var(--web); }
.ok-txt { color: var(--ok-dk); font-weight: 700; font-size: 14px; }
.bad-txt { color: var(--bad-dk); font-weight: 700; }
.date.web { background: var(--web-bg); color: var(--web-dk); }
.date.web.urgent, .date.mae.urgent { background: var(--bad-bg); color: var(--bad-dk); }
