/* OpenRO Admin: mesma paleta do site e do painel (azul-marinho + dourado). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #FFC94D;
  --primary-deep: #E3A52A;
  --primary-ink: #1A1204;
  --primary-soft: rgba(255, 201, 77, 0.10);
  --accent: #5AB0E8;
  --success: #4ADE80;
  --warn: #F5B544;
  --danger: #F87171;
  --discord: #5865F2;
  --bg: #070F20;
  --bg-2: #0A1428;
  --panel: #0E1A33;
  --panel-2: #13244A;
  --hover: #182B57;
  --border: #1C2E58;
  --text: #F4ECD8;
  --muted: #94A0B8;
  --dim: #63708B;
  --radius: 14px;
  --sidebar: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
small { font-size: 12px; }
[hidden] { display: none !important; }

/* ---- layout ------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 34px; height: 34px; }
.brand strong { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand strong span { color: var(--primary); }
.brand .tag { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); }
.sidebar-foot .who { font-size: 12px; color: var(--muted); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .links { display: flex; gap: 6px; flex-wrap: wrap; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 28px; background: rgba(7, 15, 32, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 24px 28px 60px; max-width: 1280px; }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  background: linear-gradient(180deg, #FFDA7A, #FFC94D 55%, #E9AE33); color: var(--primary-ink);
  font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  transition: filter .12s, transform .06s, background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn.ghost { background: var(--panel); border-color: var(--border); color: var(--text); box-shadow: none; font-weight: 600; }
.btn.ghost:hover:not(:disabled) { border-color: rgba(255,201,77,.45); background: var(--panel-2); filter: none; }
.btn.danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.45); color: #FCA5A5; box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: rgba(248,113,113,.2); filter: none; }
.btn.discord { background: var(--discord); color: #fff; box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 12px 18px; font-size: 14px; }
.btn.block { width: 100%; }
.icon-btn { padding: 7px; }

/* ---- cards ------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(19,36,74,.5), rgba(14,26,51,.9));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.card.pad { padding: 20px; }
.card.gold { border-color: rgba(255,201,77,.5); box-shadow: 0 0 0 1px rgba(255,201,77,.15), 0 18px 50px -24px rgba(255,201,77,.4); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head .hint, .hint { font-size: 12px; color: var(--muted); }
.card-body { padding: 18px 20px; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.stat .value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; }
.stat .value.gold { color: var(--primary); }
.stat .foot { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---- forms ------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,201,77,.12); }
input[type=file] { color: var(--muted); font-size: 13px; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-weight: 600;
}
textarea { resize: vertical; min-height: 90px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { margin-top: 2px; accent-color: var(--primary); }
.form-row { display: grid; gap: 12px; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
.form-stack { display: grid; gap: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { position: relative; min-width: 240px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--dim); }
.search input { padding-left: 34px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--primary-soft); border-color: rgba(255,201,77,.5); color: var(--primary); }
.chip .n { opacity: .7; margin-left: 3px; }

/* ---- tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 11px 16px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--dim); border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid rgba(28,46,88,.6); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
tr.attention td { background: rgba(74,222,128,.05); }
tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--success); }
td.right, th.right { text-align: right; }
td.nowrap { white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }

/* ---- badges ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.badge.ok { background: rgba(74,222,128,.12); color: var(--success); border-color: rgba(74,222,128,.3); }
.badge.warn { background: rgba(245,181,68,.12); color: var(--warn); border-color: rgba(245,181,68,.3); }
.badge.danger { background: rgba(248,113,113,.12); color: var(--danger); border-color: rgba(248,113,113,.3); }
.badge.gold { background: var(--primary-soft); color: var(--primary); border-color: rgba(255,201,77,.4); }
.badge.blue { background: rgba(90,176,232,.12); color: var(--accent); border-color: rgba(90,176,232,.3); }
.badge.muted { background: rgba(148,160,184,.08); color: var(--muted); border-color: rgba(148,160,184,.2); }

/* ---- lists ------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid rgba(28,46,88,.6);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { min-width: 0; flex: 1; }
.list-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.all-clear { display: flex; align-items: center; gap: 10px; padding: 22px 20px; color: var(--muted); }
.all-clear svg { width: 20px; height: 20px; color: var(--success); }

.callout {
  border: 1px solid rgba(255,201,77,.35); background: var(--primary-soft); border-radius: 12px;
  padding: 14px 16px; display: grid; gap: 8px;
}
.callout .link { word-break: break-all; color: var(--muted); }

.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.status-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--border); background: var(--panel); text-align: left;
}
.status-btn:hover:not(:disabled) { border-color: rgba(255,201,77,.45); background: var(--panel-2); }
.status-btn:disabled { opacity: .5; cursor: wait; }
.status-btn .emoji { font-size: 20px; }
.status-btn strong { font-size: 14px; }
.status-btn small { color: var(--muted); }

.discord-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.discord-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid rgba(28,46,88,.6); }
.discord-row:last-child { border-bottom: 0; }
.handle { display: flex; align-items: center; gap: 6px; font-weight: 700; }

/* ---- login ------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; }
.login-card .logo { width: 72px; height: 72px; display: block; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.login-card .sub { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 13px; }
.login-card form { display: grid; gap: 14px; }
.err { color: #FCA5A5; font-size: 13px; min-height: 18px; }
.login-card .hint { text-align: center; margin-top: 16px; }

/* ---- modal ------------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(3, 7, 16, .72); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
}
.modal { width: 100%; max-width: 480px; padding: 24px; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.modal-head h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.modal h4 { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 22px 0 8px; }
.modal .table-wrap { border: 1px solid var(--border); border-radius: 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }

/* ---- toast ------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 11px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border);
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.7); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 200; max-width: calc(100vw - 32px); font-weight: 600;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(74,222,128,.5); }
.toast.err { border-color: rgba(248,113,113,.6); color: #FCA5A5; }

/* ---- responsivo -------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; min-width: 0;
    padding: 10px 12px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible;
  }
  .brand { padding: 0; }
  .brand .tag, .brand strong { display: none; }
  .nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 11px; }
  .nav a svg { display: none; }
  .sidebar-foot { display: none; }
  .topbar { position: static; padding: 16px; }
  .view { padding: 16px 16px 60px; }
  .grid.two, .discord-cols { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-row .field:first-child, .form-row .actions { grid-column: 1 / -1; }
  .search { min-width: 0; width: 100%; }
  .list-row { padding: 12px 16px; }
  .list-row:has(> .btn) { flex-wrap: wrap; }
  .card-head { padding: 14px 16px; }
  .inline-form { flex-wrap: wrap; }
  .inline-form input { flex: 1 1 100%; }
  .inline-form .btn { flex: 1; }

  /* tabelas viram cartões */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { padding: 4px 0; border: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 12px; text-align: right; align-items: center; }
  table.cards td > * { grid-column: 2; justify-self: end; }
  table.cards td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 3; align-self: start; color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: left; padding-top: 3px; }
  table.cards td[data-label=""]::before { content: none; }
  table.cards td.actions-cell { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  table.cards td.empty { display: block; text-align: center; }
  table.cards td.actions-cell::before { content: none; }
  tr.attention td:first-child { box-shadow: none; }
  tr.attention { box-shadow: inset 3px 0 0 var(--success); }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .value { font-size: 24px; }
  .topbar h1 { font-size: 18px; }
  .modal { padding: 18px; }
}

/* ícones soltos em títulos e linhas */
.card-head h2 svg, .card-title svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--primary); }
.list-row > svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.handle .btn svg { width: 13px; height: 13px; }
