/* ============================================================
   OhMyBox — Design System v2.0
   Mobile-first · Unified · Complete
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* ── TOKENS ── */
:root {
  --red:        #FF2B56;
  --red-dark:   #D42348;
  --red-light:  #FDE8ED;
  --red-border: #F8B4C5;

  --teal:        #9CD8DA;
  --teal-dark:   #2A9DA0;
  --teal-light:  #E0F5F5;
  --teal-border: #B8E8E9;

  --gold:        #C9960A;
  --gold-dark:   #9A7200;
  --gold-light:  #FEF3C7;
  --gold-border: #F5D87A;

  --dark:      #1A1A1A;
  --gray-900:  #333333;
  --gray-700:  #555555;
  --gray-500:  #888888;
  --gray-300:  #BBBBBB;
  --gray-100:  #EFEFEF;
  --gray-50:   #F5F5F5;
  --white:     #FFFFFF;

  --success:        #1A9E6E;
  --success-light:  #E1F5EE;
  --success-border: #9FE1CB;
  --warning:        #B8860B;
  --warning-light:  #FAEEDA;
  --warning-border: #FAC775;
  --error:          #C0392B;

  --cat-bronze-bg:#F5E8DC; --cat-bronze-fg:#6B3D12;
  --cat-prata-bg: #F0F0F1; --cat-prata-fg: #3D4350;
  --cat-ouro-bg:  #FAF0CC; --cat-ouro-fg:  #5C3D00;
  --cat-plat-bg:  #EEF8F5; --cat-plat-fg:  #1A4D40;
  --cat-dia-bg:   #F5EEFB; --cat-dia-fg:   #3A1860;

  --sidebar-w: 200px;
  --header-h:  64px;
  --body-px:   28px;
  --body-py:   22px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 14px; --r-xl: 20px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12);
  --t: .15s ease;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  font-family: 'Roboto', sans-serif;
  background: var(--gray-50);
  color: var(--dark);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;   /* global safety net */
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: 'Roboto', sans-serif; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: 'Roboto', sans-serif; }
img, svg { max-width: 100%; }

/* ── SHELL ── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  z-index: 200;
  transition: transform .28s ease;
}
.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-300);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 16px 3px;
}
.sidebar-group { padding: 3px 0; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--gray-700);
  transition: background var(--t), color var(--t);
  position: relative;
  white-space: nowrap;
}
.sidebar-link:hover { background: var(--red-light); color: var(--red); }
.sidebar-link.active {
  color: var(--red);
  font-weight: 700;
  background: var(--red-light);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 3px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}
.sidebar-divider { border: none; border-top: 1px solid var(--gray-100); margin: 3px 0; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--gray-100); padding: 6px 0; flex-shrink: 0; }

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 190;
  backdrop-filter: blur(2px);
}

/* ── MAIN ── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── PAGE HEADER ── */
.page-header {
  background: var(--red);
  color: var(--white);
  padding: 0 var(--body-px);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
}
.page-header-inner {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
}
.header-tag {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--r-xl);
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 1px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-header .header-sub { font-size: 12px; opacity: .82; }

/* ── MENU TOGGLE (mobile only) ── */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: var(--white);
  flex-shrink: 0;
  transition: background var(--t);
}
.menu-toggle:hover { background: rgba(255,255,255,.25); }

/* ── BTN HOW ── */
.btn-how {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.4);
  color: var(--white);
  padding: 7px 14px;
  border-radius: var(--r-xl);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--t);
}
.btn-how:hover { background: rgba(255,255,255,.28); }

/* ── BODY ── */
.body-wrap {
  padding: var(--body-py) var(--body-px) 48px;
  min-width: 0;
}

/* ── GRIDS ── */
.grid-main   { display: grid; grid-template-columns: 1fr 272px; gap: 20px; align-items: start; min-width: 0; }
.grid-3      { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.grid-2      { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col-side    { position: sticky; top: 20px; }

/* ── SECTION LABEL ── */
.slbl {
  font-size: 10px; font-weight: 700; color: var(--gray-300);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 11px;
  display: flex; align-items: center; gap: 10px;
}
.slbl::after { content: ''; flex: 1; border-top: 1px solid var(--gray-100); }

/* ── CARD ── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-hdr {
  padding: 12px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-hdr h3 { font-size: 13px; font-weight: 700; color: var(--dark); }
.card-meta { font-size: 11px; color: var(--gray-300); flex-shrink: 0; }
.card-body { padding: 16px 18px; }

/* ── SIDE CARD ── */
.side-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 12px;
}
.side-hdr { padding: 11px 15px; }
.side-hdr h3 { font-size: 13px; font-weight: 700; color: var(--white); margin-bottom: 1px; }
.side-hdr p  { font-size: 11px; color: rgba(255,255,255,.8); }
.side-hdr.red   { background: var(--red); }
.side-hdr.teal  { background: var(--teal-dark); }
.side-hdr.gold  { background: var(--gold); }
.side-hdr.dark  { background: var(--gray-900); }
.side-body { padding: 11px 15px; }
.side-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--gray-100);
}
.side-row:last-child { border-bottom: none; }
.s-key { color: var(--gray-500); }
.s-val { font-weight: 700; color: var(--dark); }
.s-val.green { color: var(--success); }
.s-val.red   { color: var(--red); }
.s-val.gold  { color: var(--gold); }
.s-val.teal  { color: var(--teal-dark); }

/* ── PILLS ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--r-xl); padding: 3px 9px;
  font-size: 11px; font-weight: 700;
}
.pill.success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.pill.warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.pill.red     { background: var(--red-light); color: #7A0D25; border: 1px solid var(--red-border); }
.pill.teal    { background: var(--teal-light); color: var(--teal-dark); border: 1px solid var(--teal-border); }
.pill.gray    { background: var(--gray-100); color: var(--gray-500); border: 1px solid #E0E0E0; }
.pill.purple  { background: #EEEDFE; color: #3C3489; border: 1px solid #AFA9EC; }
.pill.gold    { background: var(--gold-light); color: var(--gold-dark); border: 1px solid var(--gold-border); }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--red); color: var(--white); border: none;
  border-radius: var(--r-md); padding: 10px 20px;
  font-size: 13px; font-weight: 700;
  transition: opacity var(--t);
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: transparent; color: var(--gray-700);
  border: 1.5px solid var(--gray-100);
  border-radius: var(--r-md); padding: 10px 20px;
  font-size: 13px; font-weight: 700;
  transition: border-color var(--t), color var(--t);
}
.btn-secondary:hover { border-color: var(--red); color: var(--red); }
.btn-ghost-red {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; color: var(--red); border: none;
  font-size: 12px; font-weight: 700; padding: 0;
  transition: opacity var(--t);
}
.btn-ghost-red:hover { opacity: .72; }

/* ── FORMS ── */
.field-wrap { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field-label { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.field-req { color: var(--red); }
.field-input, .field-select, .field-textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid #E0E0E0; border-radius: var(--r-sm);
  font-size: 13px; font-family: 'Roboto', sans-serif; color: var(--dark);
  background: var(--white); outline: none;
  transition: border-color var(--t);
  -webkit-appearance: none;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--red); }
.field-input:disabled { background: var(--gray-50); color: var(--gray-300); cursor: not-allowed; }
.field-hint { font-size: 11px; color: var(--gray-300); line-height: 1.4; }
.field-textarea { resize: vertical; min-height: 80px; }

/* ── MODAL ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 400;
  align-items: center; justify-content: center; padding: 16px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--r-lg);
  max-width: 460px; width: 100%; max-height: 90vh;
  overflow-y: auto; overflow-x: hidden;
  box-shadow: var(--shadow-md);
}
.modal-hdr {
  padding: 15px 18px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-hdr h2 { font-size: 15px; font-weight: 700; color: var(--dark); }
.modal-close { color: var(--gray-300); font-size: 22px; line-height: 1; padding: 2px; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 16px 18px 22px; }
.modal-sec { margin-bottom: 14px; }
.modal-sec:last-child { margin-bottom: 0; }
.modal-sec-lbl {
  font-size: 10px; font-weight: 700; color: var(--gray-300);
  text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: 5px; margin-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-sec p  { font-size: 13px; color: var(--gray-700); line-height: 1.65; }
.modal-sec ul { padding-left: 16px; }
.modal-sec ul li { font-size: 13px; color: var(--gray-700); line-height: 1.65; list-style: disc; margin-bottom: 3px; }
.modal-note {
  background: var(--teal-light); border: 1px solid var(--teal-border);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12px; color: #085041; line-height: 1.6; margin: 10px 0;
}
.modal-warn {
  background: var(--warning-light); border: 1px solid var(--warning-border);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12px; color: #633806; line-height: 1.6; margin: 10px 0;
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--white); border: 1px solid var(--gray-100); border-radius: var(--r-md);
  padding: 10px 18px; font-size: 13px; color: var(--dark);
  display: flex; align-items: center; gap: 8px;
  z-index: 500; opacity: 0; transition: opacity .25s;
  pointer-events: none; box-shadow: var(--shadow-md); white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; }

/* ── LINK ROW ── */
.link-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--gray-100);
  font-size: 13px; color: var(--gray-700);
  transition: color var(--t);
}
.link-row:last-child { border-bottom: none; }
.link-row:hover { color: var(--red); }

/* ── TABLE WRAPPER — prevents overflow ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── UTILITY ── */
.w-full { width: 100%; }
.mb-0  { margin-bottom: 0 !important; }
.mb-8  { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; }
.text-sm   { font-size: 12px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--gray-500); }
.text-red  { color: var(--red); }
.text-green { color: var(--success); }
.text-gold  { color: var(--gold); }
.font-bold  { font-weight: 700; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hidden { display: none; }

/* ════════════════════════════════════════════════
   RESPONSIVE — Mobile-first breakpoints
   ════════════════════════════════════════════════ */

/* ── TABLET 900px ── */
@media (max-width: 900px) {
  .grid-main { grid-template-columns: 1fr; }
  .col-side  { position: static; }
}

/* ── MOBILE 768px ── */
@media (max-width: 768px) {
  :root {
    --body-px: 16px;
    --body-py: 16px;
    --header-h: auto;
  }

  /* Shell adapts to content height */
  .shell { flex-direction: row; height: 100vh; overflow: hidden; }

  /* Sidebar becomes full-height drawer */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
    z-index: 200;
    height: 100%;
  }
  .sidebar.open  { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* Main scrolls independently */
  .main { overflow-y: auto; height: 100vh; }

  /* Show menu toggle */
  .menu-toggle { display: flex; }

  /* Header adapts */
  .page-header {
    padding: 12px 16px;
    gap: 10px;
  }
  .page-header h1 { font-size: 17px; }
  .page-header .header-sub { display: none; } /* hide subtitle on small screens */
  .btn-how { padding: 6px 10px; font-size: 11px; }

  /* Grids collapse */
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  /* Body padding */
  .body-wrap { padding: 14px 16px 48px; }

  /* Cards */
  .card-body  { padding: 14px 15px; }
  .card-hdr   { padding: 11px 15px; }
  .side-body  { padding: 11px 14px; }
}

/* ── MOBILE 480px ── */
@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }

  /* Modals become bottom sheets */
  .overlay { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 88vh;
  }

  /* btn-how: compact icon+? on small screens */
  .btn-how { padding: 6px 10px; font-size: 0; }
  .btn-how svg { display: block; }
  .btn-how::after { content: '?'; font-size: 13px; font-weight: 700; color: #fff; margin-left: 3px; }
}
