@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --bg:       #F5F5F7;
  --surface:  #FFFFFF;
  --surface2: #F0F0F2;
  --surface3: #E8E8EC;
  --border:   #E2E2E8;
  --text:     #1A1A2E;
  --text2:    #6B6B80;
  --text3:    #A0A0B0;
  --accent:   #dc1e45;
  --aplus:    #0BAF82;
  --a:        #22C55E;
  --b:        #EAB308;
  --c:        #F97316;
  --r:        #EF4444;
  --sidebar:  220px;
  --topbar:   56px;
  --radius:   10px;
  --shadow:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Poppins', sans-serif; font-size: 13.5px; display: flex; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { font-weight: 600; }
button, input, select, textarea { font-family: inherit; font-size: 13.5px; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar); min-height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: -.3px;
}
.sidebar-logo span { color: var(--text2); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; color: var(--text2); font-size: 13px; font-weight: 400;
  transition: all .15s; border-left: 2px solid transparent; cursor: pointer;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: #FDEAEE; color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); color: var(--text3); font-size: 12px; }

/* MAIN */
.main-wrap { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--topbar); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.page-content { padding: 24px 28px; flex: 1; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; }

/* BIG NUMBERS */
.big-numbers { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.big-num { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.big-num .label { font-size: 11px; color: var(--text3); margin-bottom: 6px; font-weight: 500; }
.big-num .value { font-size: 32px; font-weight: 700; line-height: 1; color: var(--text); }
.big-num.critico .value { color: var(--r); }
.big-num.alerta  .value { color: var(--c); }
.big-num.ok      .value { color: var(--aplus); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; font-weight: 500; font-size: 13px;
  cursor: pointer; border: none; transition: all .15s;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #4A3CE0; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-danger    { background: var(--r); color: #fff; }
.btn-danger:hover   { background: #DC2626; }
.btn-ghost     { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover    { background: var(--surface2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600;
}
.badge-sem { background: var(--surface3); color: var(--text3); }

/* TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text2); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
tr.clickable { cursor: pointer; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 8px 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(220,30,69,.12); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { min-height: 88px; resize: vertical; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; appearance: none; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 200; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 560px; max-width: calc(100vw - 40px); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.12); }
.modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* NOTA BUTTONS */
.nota-btns { display: flex; gap: 7px; }
.nota-btn {
  width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 14px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.nota-btn[data-nota="aplus"] { background: #E6FAF5; color: var(--aplus); border-color: #B3EFE0; }
.nota-btn[data-nota="a"]     { background: #DCFCE7; color: var(--a);    border-color: #A7F3C0; }
.nota-btn[data-nota="b"]     { background: #FEF9C3; color: var(--b);    border-color: #FDE047; }
.nota-btn[data-nota="c"]     { background: #FFF0E6; color: var(--c);    border-color: #FDBA74; }
.nota-btn[data-nota="r"]     { background: #FEE2E2; color: var(--r);    border-color: #FCA5A5; }
.nota-btn.active[data-nota="aplus"] { background: var(--aplus); color: #fff; border-color: var(--aplus); }
.nota-btn.active[data-nota="a"]     { background: var(--a);    color: #fff; border-color: var(--a); }
.nota-btn.active[data-nota="b"]     { background: var(--b);    color: #fff; border-color: var(--b); }
.nota-btn.active[data-nota="c"]     { background: var(--c);    color: #fff; border-color: var(--c); }
.nota-btn.active[data-nota="r"]     { background: var(--r);    color: #fff; border-color: var(--r); }

/* PROGRESS */
.progress { background: var(--surface3); border-radius: 4px; height: 5px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s; }

/* FILTERS */
.filters-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.filters-bar input, .filters-bar select { padding: 7px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 13px; font-family: inherit; }
.filters-bar input { flex: 1; min-width: 160px; }

/* ALERTS */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-danger  { background: #FEE2E2; border: 1px solid #FCA5A5; color: #B91C1C; }
.alert-warning { background: #FFF0E6; border: 1px solid #FDBA74; color: #C2410C; }
.alert-success { background: #DCFCE7; border: 1px solid #A7F3C0; color: #15803D; }

/* CALENDAR */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-header-day { text-align: center; padding: 8px; font-size: 11px; color: var(--text3); font-weight: 600; }
.cal-day { min-height: 88px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px; }
.cal-day.other-month { background: var(--surface2); opacity: .6; }
.cal-day.today { border-color: var(--accent); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text3); margin-bottom: 4px; }
.cal-event { font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* TOAST */
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 18px; font-size: 13px; color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  transform: translateY(70px); opacity: 0; transition: all .25s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--aplus); }
.toast.error   { border-color: var(--r); }

/* LOGIN */
.login-wrap { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 36px; box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.login-logo { font-size: 20px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.login-sub { color: var(--text3); font-size: 13px; margin-bottom: 26px; }

/* DETAIL */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.section-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.section-title { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px; }

/* UTILS */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mt-4  { margin-top: 4px; }  .mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-4  { margin-bottom: 4px; } .mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-muted   { color: var(--text2); }
.text-dim     { color: var(--text3); }
.text-sm      { font-size: 12px; }
.text-danger  { color: var(--r); }
.text-warning { color: var(--c); }
.text-success { color: var(--aplus); }
.fw-bold      { font-weight: 600; }
.hidden       { display: none !important; }
.p-8 { padding: 8px; }

/* NAV SECTION LABEL */
.nav-section {
  padding: 14px 18px 4px;
  font-size: 10px; font-weight: 600;
  color: var(--text3); letter-spacing: .8px; text-transform: uppercase;
}
