
:root{
  --bg:#07142b;
  --bg-2:#06101f;
  --panel:rgba(9,24,50,.92);
  --panel-2:#0a1730;
  --border:#22385d;
  --text:#f5f7fb;
  --muted:#b8c7e6;
  --primary:#17a7f3;
  --primary-dark:#0b7fc0;
  --danger:#cf4b4b;
  --success:#2abf77;
  --warning:#f5b301;
  --radius:16px;
  --shadow:0 8px 24px rgba(0,0,0,.18);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  font-family:Arial, Helvetica, sans-serif;
  background:linear-gradient(180deg,var(--bg) 0%, var(--bg-2) 100%);
  color:var(--text);
  line-height:1.4;
}

img{max-width:100%;height:auto;display:block}
a{color:inherit;text-decoration:none}
small,.muted{color:var(--muted)}
hr{border:none;border-top:1px solid var(--border);margin:18px 0}

.container,.wrap,main{
  width:min(1180px, calc(100% - 24px));
  margin:0 auto;
}

.topbar{
  border-bottom:1px solid var(--border);
  background:rgba(7,20,43,.96);
  position:sticky;
  top:0;
  z-index:50;
}
.topbar .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:8px 0;
}
.brand,.app-brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}
.app-brand img{
  width:125px;
  max-height:56px;
  object-fit:contain;
}
.app-brand-text{line-height:1.1}
.app-brand-title{
  font-size:1.05rem;
  font-weight:700;
  color:#fff;
}
.app-brand-subtitle{
  font-size:.75rem;
  color:#d9e9ff;
  font-weight:700;
  letter-spacing:.02em;
}

.nav{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.nav a,
.nav-links a,
.menu-links a{
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--border);
  color:#fff;
  font-size:.95rem;
}
.nav a:hover,
.nav-links a:hover,
.menu-links a:hover{
  background:rgba(255,255,255,.08);
}

.flash{
  margin:8px 0 18px 0;
  padding:14px 16px;
  border-radius:14px;
  border:1px solid var(--border);
}
.flash.success{
  background:rgba(42,191,119,.15);
  border-color:rgba(42,191,119,.4);
}
.flash.error{
  background:rgba(207,75,75,.15);
  border-color:rgba(207,75,75,.4);
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:22px;
  padding:24px;
  box-shadow:var(--shadow);
  overflow:hidden;
}

.grid{display:grid;gap:16px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}

.flex-between{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

h1,h2,h3{margin:0 0 14px 0;line-height:1.15}
h1{font-size:2.2rem}
h2{font-size:1.45rem}
h3{font-size:1.15rem}
.big-number{
  font-size:2.5rem;
  font-weight:700;
  line-height:1;
}

label{
  display:block;
  margin:0 0 8px 0;
  color:#e9f1ff;
  font-weight:600;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="file"],
select,
textarea{
  width:100%;
  min-height:48px;
  border:1px solid #24406e;
  background:#04102a;
  color:#fff;
  border-radius:14px;
  padding:12px 14px;
  outline:none;
  font-size:16px;
  margin-bottom:14px;
}
textarea{min-height:110px;resize:vertical}
input:focus,select:focus,textarea:focus{
  border-color:#2eaef8;
  box-shadow:0 0 0 3px rgba(46,174,248,.16);
}
input::placeholder,textarea::placeholder{color:#90a7cf}

button,.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:46px;
  padding:10px 18px;
  border:none;
  border-radius:14px;
  background:var(--primary);
  color:#07142b;
  font-weight:700;
  cursor:pointer;
  text-align:center;
}
button:hover,.btn:hover{filter:brightness(1.04)}
.btn-secondary{background:#22385d;color:#fff}
.btn-danger{background:var(--danger);color:#fff}
.btn-success{background:var(--success);color:#fff}

.table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:16px;
}
table{
  width:100%;
  min-width:720px;
  border-collapse:collapse;
  background:rgba(3,11,26,.55);
}
th,td{
  padding:12px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  text-align:left;
}
th{
  color:#d9e9ff;
  font-weight:700;
  background:rgba(10,23,48,.92);
  position:sticky;
  top:0;
}

.signature-pad{
  width:100%;
  max-width:100%;
  min-height:180px;
  border:1px dashed #36588f;
  border-radius:16px;
  background:#fff;
}
canvas{touch-action:none}

/* Login */
.login-page,.login-shell,.login-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
}
.login-box,.login-card{
  width:min(460px, 100%);
  padding:28px;
  border-radius:24px;
  background:rgba(8,19,41,.85);
  border:1px solid var(--border);
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
}
.hero-note{margin-bottom:12px}

.stats-card{display:flex;flex-direction:column;gap:8px}
.stats-card .big-number{font-size:2rem;font-weight:700}

@media (max-width: 980px){
  .container,.wrap,main{
    width:min(100%, calc(100% - 18px));
  }
  .grid-3{grid-template-columns:1fr 1fr}
}

@media (max-width: 760px){
  body{font-size:15px}
  .card{padding:16px;border-radius:18px}
  h1{font-size:1.65rem}
  h2{font-size:1.25rem}
  h3{font-size:1.05rem}
  .grid-2,.grid-3{grid-template-columns:1fr !important}
  .flex-between{align-items:stretch}
  .flex-between > *{width:100%}
  button,.btn{width:100%}
  table{min-width:640px}
  .signature-pad{min-height:150px}
  .topbar .container{flex-direction:column;align-items:stretch}
  .nav{justify-content:flex-start}
  .nav a,.nav-links a,.menu-links a{width:100%}
}

@media print{
  body{background:#fff !important;color:#000 !important}
  .card{box-shadow:none !important;border:none !important;background:#fff !important}
}


/* ===== AJUSTE COMPACTO CONTROLADO ===== */

body{
  font-size:14px;
}

.container{
  max-width:1200px;
  margin:0 auto;
}

.nav{
  flex-wrap:wrap;
  gap:6px;
}

.nav a{
  padding:6px 10px;
  font-size:13px;
}

.card{
  padding:16px;
}

.stats-horizontal{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
}

.stat-item{
  min-height:90px;
  padding:10px;
  border-radius:14px;
  text-align:center;
}

.stat-label{
  font-size:0.85rem;
}

.stat-value{
  font-size:1.6rem;
  font-weight:600;
}

.stat-open{
  background:rgba(23,167,243,0.12);
}

.stat-today{
  background:rgba(42,191,119,0.12);
}

.stat-overdue{
  background:rgba(207,75,75,0.14);
}

table{
  font-size:13px;
}

th, td{
  padding:8px;
}

input, select, textarea{
  min-height:40px;
  font-size:14px;
  padding:8px 10px;
}

button, .btn{
  min-height:40px;
  font-size:14px;
  padding:8px 12px;
}

@media (max-width:900px){
  .stats-horizontal{
    grid-template-columns:repeat(2,1fr);
  }
}

@media (max-width:500px){
  .stats-horizontal{
    grid-template-columns:1fr;
  }
}

@media (max-width: 768px) {
    .btn,
    button {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }

    .btn:last-child,
    button:last-child {
        margin-bottom: 0;
    }
}