/* ============================================================
   SISTEMA TRIBUTARIO COLOMBIA – style.css (CSS puro, sin deps)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:      #f0f4f8;
  --c-card:    #ffffff;
  --c-nav:     #ffffff;
  --c-border:  #e2e8f0;
  --c-input-b: #cbd5e1;
  --c-txt:     #0f172a;
  --c-txt2:    #475569;
  --c-muted:   #94a3b8;
  --c-primary: #1e40af;
  --c-primary-h:#1d4ed8;
  --c-accent:  #3b82f6;
  --c-green:   #15803d;
  --c-red:     #991b1b;
  --c-orange:  #c2410c;
  --c-purple:  #6d28d9;
  --c-yellow:  #a16207;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);
  --r:         .75rem;
  --r-sm:      .375rem;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html.dark {
  --c-bg:      #0f172a;
  --c-card:    #1e293b;
  --c-nav:     #1e293b;
  --c-border:  #334155;
  --c-input-b: #475569;
  --c-txt:     #f1f5f9;
  --c-txt2:    #94a3b8;
  --c-muted:   #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.45);
}

body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-txt);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-muted); }

/* ── NAVBAR ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--c-nav);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  gap: 1rem;
}
.nav-brand { display: flex; align-items: center; gap: .625rem; }
.nav-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.nav-brand-name { font-size: 1rem; font-weight: 700; color: var(--c-txt); }
.nav-brand-sub  { font-size: .65rem; color: var(--c-muted); }
.nav-actions { display: flex; align-items: center; gap: .625rem; }
.nav-back {
  display: inline-flex; align-items: center; gap: .375rem;
  color: var(--c-accent); font-weight: 600; font-size: .875rem;
  padding: .375rem .75rem;
  border-radius: var(--r-sm);
  transition: background .15s;
}
.nav-back:hover { background: #eff6ff; }
html.dark .nav-back:hover { background: #1e3a8a22; }

/* ── USER CHIP ── */
.user-chip {
  display: flex; align-items: center; gap: .5rem;
  padding: .375rem .75rem;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 9999px;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #1e40af, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 800; color: #fff; flex-shrink: 0;
}
.user-name  { font-size: .8rem; font-weight: 600; color: var(--c-txt); }
.user-role  { font-size: .65rem; color: var(--c-muted); }

/* ── THEME TOGGLE ── */
.btn-theme {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; transition: all .15s;
}
.btn-theme:hover { background: var(--c-border); transform: scale(1.05); }

/* ── MAIN CONTENT ── */
.main { max-width: 82rem; margin: 0 auto; padding: 1.5rem; }
.main-sm { max-width: 56rem; margin: 0 auto; padding: 1.5rem; }
.main-md { max-width: 72rem; margin: 0 auto; padding: 1.5rem; }

/* ── PAGE HEADER ── */
.page-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem;
}
.page-hd h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--c-txt); }
.page-hd .sub { font-size: .8rem; color: var(--c-muted); margin-top: .2rem; }

/* ── SECTION HEADER ── */
.sec-hd {
  display: flex; align-items: center; gap: .625rem; margin-bottom: 1rem;
}
.sec-hd h2 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-txt2); white-space: nowrap; }
.sec-hr { flex: 1; height: 1px; background: var(--c-border); }

/* ── CARDS ── */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-p { padding: 1.5rem; }
.card-p-sm { padding: 1rem 1.25rem; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 1.375rem 1.5rem; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:4px; }
.stat-blue::before   { background: linear-gradient(90deg,#1e40af,#3b82f6); }
.stat-orange::before { background: linear-gradient(90deg,#c2410c,#f97316); }
.stat-purple::before { background: linear-gradient(90deg,#6d28d9,#8b5cf6); }
.stat-green::before  { background: linear-gradient(90deg,#15803d,#22c55e); }
.stat-val { font-size: 2.25rem; font-weight: 800; line-height: 1; margin-bottom: .35rem; }
.stat-lbl { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-txt2); }
.stat-ico { position:absolute; top:1.1rem; right:1.1rem; font-size:1.75rem; opacity:.12; }
.stat-blue   .stat-val { color: #1e40af; }
.stat-orange .stat-val { color: #c2410c; }
.stat-purple .stat-val { color: #6d28d9; }
.stat-green  .stat-val { color: #15803d; }
html.dark .stat-blue   .stat-val { color: #93c5fd; }
html.dark .stat-orange .stat-val { color: #fdba74; }
html.dark .stat-purple .stat-val { color: #c4b5fd; }
html.dark .stat-green  .stat-val { color: #86efac; }

/* Action cards */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.action-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: 1.375rem; text-align: left; display: block; width: 100%;
  transition: all .2s; cursor: pointer;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--c-accent); background: var(--c-bg); }
.action-ico {
  width: 44px; height: 44px; border-radius: 11px;
  background: #eff6ff; display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; margin-bottom: .875rem;
}
html.dark .action-ico { background: #1e3a8a33; }
.action-card h3 { font-size: .9rem; font-weight: 700; color: var(--c-txt); }
.action-card p  { font-size: .75rem; color: var(--c-txt2); margin-top: .2rem; }

/* Link cards */
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: .875rem; margin-bottom: 1.5rem; }
.link-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--r); box-shadow: var(--shadow-sm);
  padding: .875rem 1.125rem;
  display: flex; align-items: center; gap: .75rem;
  transition: all .2s;
}
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--c-accent); background: var(--c-bg); }
.lc-ico {
  font-size: 1.375rem; flex-shrink: 0;
  width: 38px; height: 38px;
  background: var(--c-bg); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.lc-title { font-size: .875rem; font-weight: 600; color: var(--c-txt); }
.lc-sub   { font-size: .72rem; color: var(--c-muted); margin-top: 1px; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--c-bg);
  color: var(--c-txt2);
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: .75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--c-border);
}
tbody tr { border-bottom: 1px solid var(--c-border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--c-bg); }
tbody td { padding: .75rem 1rem; font-size: .875rem; color: var(--c-txt); vertical-align: middle; }
.tr-vencida { background: #fef2f200; border-left: 3px solid #ef4444; }
html.dark .tr-vencida { border-left-color: #f87171; }

/* ── INPUTS ── */
.inp {
  width: 100%;
  background: var(--c-card); border: 1px solid var(--c-input-b);
  border-radius: var(--r-sm); padding: .6rem .875rem;
  font-size: .875rem; color: var(--c-txt);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.inp:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.inp::placeholder { color: var(--c-muted); }
label, .lbl {
  display: block; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-txt2); margin-bottom: .375rem;
}
.field-hint { font-size: .72rem; color: var(--c-muted); margin-top: .3rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1.1rem; border-radius: var(--r-sm);
  font-size: .875rem; font-weight: 600; border: none;
  cursor: pointer; transition: all .15s; text-decoration: none;
  white-space: nowrap;
}
.btn-sm { padding: .35rem .75rem; font-size: .75rem; }
.btn-primary { background: linear-gradient(135deg,#1e40af,#3b82f6); color:#fff; box-shadow:0 2px 6px rgba(30,64,175,.35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow:0 4px 12px rgba(30,64,175,.45); }
.btn-success { background: linear-gradient(135deg,#15803d,#22c55e); color:#fff; box-shadow:0 2px 6px rgba(21,128,61,.35); }
.btn-success:hover { transform: translateY(-1px); box-shadow:0 4px 12px rgba(21,128,61,.45); }
.btn-danger { background: linear-gradient(135deg,#991b1b,#ef4444); color:#fff; box-shadow:0 2px 6px rgba(153,27,27,.3); }
.btn-danger:hover { transform: translateY(-1px); }
.btn-warning { background: linear-gradient(135deg,#b45309,#f59e0b); color:#fff; }
.btn-warning:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--c-txt2); border: 1px solid var(--c-border); }
.btn-ghost:hover { background: var(--c-bg); color: var(--c-txt); }
.btn-link { background: transparent; color: var(--c-accent); border: none; padding: .35rem .625rem; }
.btn-link:hover { background: #eff6ff; border-radius: var(--r-sm); }
html.dark .btn-link:hover { background: #1e3a8a22; }
.btn-full { width: 100%; justify-content: center; }

/* Inline action buttons inside tables */
.act-edit   { color: var(--c-accent); font-size:.8rem; font-weight:600; padding:.3rem .625rem; border-radius:6px; transition: background .12s; }
.act-edit:hover   { background: #eff6ff; }
.act-del    { color: #dc2626; font-size:.8rem; font-weight:600; padding:.3rem .625rem; border-radius:6px; transition: background .12s; }
.act-del:hover    { background: #fef2f2; }
.act-ok     { color: #15803d; font-size:.8rem; font-weight:600; padding:.3rem .625rem; border-radius:6px; transition: background .12s; }
.act-ok:hover     { background: #f0fdf4; }
.act-warn   { color: #c2410c; font-size:.8rem; font-weight:600; padding:.3rem .625rem; border-radius:6px; transition: background .12s; }
.act-warn:hover   { background: #fff7ed; }
html.dark .act-edit:hover { background: #1e3a8a22; }
html.dark .act-del:hover  { background: #7f1d1d22; }
html.dark .act-ok:hover   { background: #14532d22; }
html.dark .act-warn:hover { background: #7c2d1222; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 9999px;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-blue   { background:#dbeafe; color:#1e40af; }
.badge-green  { background:#dcfce7; color:#15803d; }
.badge-red    { background:#fee2e2; color:#991b1b; }
.badge-orange { background:#ffedd5; color:#c2410c; }
.badge-yellow { background:#fef9c3; color:#a16207; }
.badge-gray   { background:#f1f5f9; color:#475569; }
.badge-purple { background:#ede9fe; color:#6d28d9; }
html.dark .badge-blue   { background:#1e3a8a44; color:#93c5fd; }
html.dark .badge-green  { background:#14532d44; color:#86efac; }
html.dark .badge-red    { background:#7f1d1d44; color:#fca5a5; }
html.dark .badge-orange { background:#7c2d1244; color:#fdba74; }
html.dark .badge-yellow { background:#71350f44; color:#fde047; }
html.dark .badge-gray   { background:#1e293b;   color:#94a3b8; }
html.dark .badge-purple { background:#4c1d9544; color:#c4b5fd; }

/* ── ALERTS ── */
.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .875rem 1.125rem; border-radius: var(--r-sm);
  font-size: .875rem; border-left: 4px solid; margin-bottom: 1rem;
}
.alert-ok   { background:#f0fdf4; border-color:#22c55e; color:#15803d; }
.alert-err  { background:#fef2f2; border-color:#ef4444; color:#991b1b; }
.alert-warn { background:#fffbeb; border-color:#f59e0b; color:#b45309; }
.alert-info { background:#eff6ff; border-color:#3b82f6; color:#1e40af; }
html.dark .alert-ok   { background:#14532d22; color:#86efac; }
html.dark .alert-err  { background:#7f1d1d22; color:#fca5a5; }
html.dark .alert-warn { background:#78350f22; color:#fde68a; }
html.dark .alert-info { background:#1e3a8a22; color:#93c5fd; }

/* ── MODAL ── */
.modal-ov {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-ov.open { display: flex; }
.modal-box {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--r); box-shadow: 0 25px 60px rgba(0,0,0,.4);
  width: 100%; max-width: 32rem; max-height: 90vh; overflow-y: auto;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}
.modal-hd h3 { font-size: 1rem; font-weight: 700; color: var(--c-txt); }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--c-border); background: var(--c-card);
  color: var(--c-muted); font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .12s;
}
.modal-close:hover { background: var(--c-border); }
.modal-bd { padding: 1.5rem; }

/* ── FORM GRID ── */
.fg { display: grid; gap: 1rem; }
.fg-2 { grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); }
.fg-3 { grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); }
.fg-4 { grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
@media(max-width:640px) { .col-2, .col-3 { grid-column: span 1; } }

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #0369a1 100%);
  padding: 1rem;
}
.login-box {
  background: #fff; border-radius: 1.25rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.45);
  width: 100%; max-width: 420px; padding: 2.5rem;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 1.25rem;
  background: linear-gradient(135deg,#1e40af,#0ea5e9);
  border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 2rem;
}
.login-box h2 { text-align:center; font-size:1.6rem; font-weight:800; color:#0f172a; margin-bottom:.375rem; }
.login-box .sub { text-align:center; color:#64748b; font-size:.85rem; margin-bottom:1.75rem; }
.login-box label { font-size:.8rem; font-weight:600; color:#374151; margin-bottom:.375rem; }
.login-box .inp { border-color:#d1d5db; }
.login-box .inp:focus { border-color:#3b82f6; }
.login-hint {
  background:#f8fafc; border:1px solid #e2e8f0; border-radius:.625rem;
  padding:.875rem; margin-top:1.25rem; text-align:center;
}
.login-hint p { font-size:.72rem; color:#6b7280; }
.login-hint code { background:#e5e7eb; padding:.1rem .3rem; border-radius:.25rem; font-size:.72rem; }

/* ── VENCIMIENTOS ── */
.venc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1rem; border-bottom: 1px solid var(--c-border);
  transition: background .12s;
}
.venc-row:last-child { border-bottom: none; }
.venc-row:hover { background: var(--c-bg); }

/* ── INFO BOX ── */
.info-box {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--r-sm);
  padding: 1rem 1.25rem; font-size: .8rem; color: #1e40af;
}
html.dark .info-box { background: #1e3a8a22; border-color: #1e40af55; color: #93c5fd; }
.info-box ul { padding-left: 1.25rem; margin-top: .5rem; display: flex; flex-direction: column; gap: .35rem; }

/* ── WARN BOX ── */
.warn-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--r-sm);
  padding: 1rem 1.25rem; font-size: .875rem; color: #b45309;
}
html.dark .warn-box { background: #78350f22; border-color: #f59e0b55; color: #fde68a; }

/* ── UTILS ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-muted { color: var(--c-muted); }
.text-accent { color: var(--c-accent); }
.text-red { color: #dc2626; }
.text-green { color: #16a34a; }
.text-orange { color: #ea580c; }
.opacity-50 { opacity: .5; }
.hidden { display: none !important; }
.inline-form { display: inline; }
.font-mono { font-family: ui-monospace, 'Courier New', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

@media(max-width:640px) {
  .main, .main-sm, .main-md { padding: 1rem; }
  .nav { padding: 0 1rem; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .action-grid { grid-template-columns: repeat(2,1fr); }
  .link-grid { grid-template-columns: 1fr 1fr; }
  .page-hd { flex-direction: column; }
}
