/*
 * NebraOT Modern UI V4 — readability + legacy-layout polish.
 * Visual layer only. It does not change routes, form names, SQL, permissions or game logic.
 */
:root {
  --n4-bg: #0c0908;
  --n4-panel: rgba(16,12,10,.95);
  --n4-panel-2: rgba(27,18,14,.96);
  --n4-panel-3: rgba(42,24,18,.92);
  --n4-border: rgba(235,184,84,.34);
  --n4-border-strong: rgba(244,195,91,.62);
  --n4-gold: #f4c768;
  --n4-gold-soft: #ffe6ac;
  --n4-text: #f8eee1;
  --n4-muted: #d2bea4;
  --n4-red: #8e2d1d;
  --n4-red-soft: #d95a3d;
}

/* ========================================================================== */
/* 1. LEGACY HEIGHT BUGS — no more giant empty panels                          */
/* ========================================================================== */
body.nebra-v2-ready .Content .SmallBox,
body.nebra-v2-ready .Content .SmallBox .MessageContainer,
body.nebra-v2-ready .Content .SmallBox .Message,
body.nebra-v2-ready .Content .SmallBox .ErrorMessage,
body.nebra-v2-ready .Content .TableContainer,
body.nebra-v2-ready .Content .TableContentContainer,
body.nebra-v2-ready .Content .TableContentAndRightShadow,
body.nebra-v2-ready .Content .InnerTableContainer,
body.nebra-v2-ready .Content .CharacterDetailsBlock {
  height: auto !important;
  min-height: 0 !important;
}

body.nebra-v2-ready .Content .SmallBox {
  display: block !important;
  width: 100% !important;
  margin: 10px 0 16px !important;
  font-size: inherit !important;
}
body.nebra-v2-ready .Content .SmallBox .MessageContainer {
  box-sizing: border-box !important;
  width: 100% !important;
  border: 1px solid var(--n4-border) !important;
  border-radius: 12px !important;
  background: linear-gradient(150deg, rgba(31,20,16,.96), rgba(13,10,8,.97)) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.24) !important;
  overflow: hidden !important;
}
body.nebra-v2-ready .Content .SmallBox .Message,
body.nebra-v2-ready .Content .SmallBox .ErrorMessage {
  box-sizing: border-box !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 15px 17px !important;
  background: transparent !important;
  color: var(--n4-text) !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}
body.nebra-v2-ready .Content .SmallBox .ErrorMessage { padding-left: 48px !important; }
body.nebra-v2-ready .Content .SmallBox .BoxFrameHorizontal,
body.nebra-v2-ready .Content .SmallBox .BoxFrameVerticalRight,
body.nebra-v2-ready .Content .SmallBox .BoxFrameVerticalLeft,
body.nebra-v2-ready .Content .SmallBox .BoxFrameEdgeLeftTop,
body.nebra-v2-ready .Content .SmallBox .BoxFrameEdgeLeftBottom,
body.nebra-v2-ready .Content .SmallBox .BoxFrameEdgeRightTop,
body.nebra-v2-ready .Content .SmallBox .BoxFrameEdgeRightBottom {
  display: none !important;
}

/* ========================================================================== */
/* 2. READABILITY — brighter text, slightly larger content                    */
/* ========================================================================== */
body.nebra-v2-ready .Content .BoxContent {
  font-size: 13.5px !important;
  line-height: 1.5 !important;
  color: var(--n4-text) !important;
}
body.nebra-v2-ready .Content .BoxContent p,
body.nebra-v2-ready .Content .BoxContent li,
body.nebra-v2-ready .Content .BoxContent td,
body.nebra-v2-ready .Content .BoxContent label,
body.nebra-v2-ready .Content .BoxContent span:not(.PercentageBar),
body.nebra-v2-ready .Content .BoxContent div:not(.PercentageBar) {
  text-shadow: none;
}
body.nebra-v2-ready .Content .BoxContent td {
  font-size: 13px !important;
  line-height: 1.45 !important;
}
body.nebra-v2-ready .Content .BoxContent b,
body.nebra-v2-ready .Content .BoxContent strong {
  color: #fff1ca;
  font-weight: 800;
}
body.nebra-v2-ready .Content .BoxContent a,
body.nebra-v2-ready .Content .BoxContent a:visited {
  color: #ffd77f !important;
}
body.nebra-v2-ready .Content .BoxContent a:hover {
  color: #fff0bd !important;
}
body.nebra-v2-ready .Content .grey,
body.nebra-v2-ready .Content small {
  color: var(--n4-muted) !important;
}
body.nebra-v2-ready .NebraModernPageTitle { color: #fff0c8 !important; }
body.nebra-v2-ready .NebraModernPageSubtitle { color: #d6bfa3 !important; opacity: 1 !important; }

/* ========================================================================== */
/* 3. DATA TABLES — replace beige/white legacy rows with dark readable rows    */
/* ========================================================================== */
body.nebra-v2-ready .Content .TableContainer {
  border: 1px solid var(--n4-border) !important;
  border-radius: 12px !important;
  background: linear-gradient(155deg, rgba(22,15,12,.96), rgba(10,8,7,.97)) !important;
  box-shadow: 0 10px 24px rgba(0,0,0,.22) !important;
  overflow: hidden !important;
}
body.nebra-v2-ready .Content .TableContainer .CaptionContainer {
  border: 0 !important;
  border-bottom: 1px solid rgba(244,199,104,.24) !important;
  background: linear-gradient(90deg, #5d1c12, #31140f 58%, #1b100d) !important;
}
body.nebra-v2-ready .Content .TableContainer .CaptionContainer .Text {
  color: #ffe7ad !important;
  font-size: 13px !important;
  line-height: 20px !important;
}
body.nebra-v2-ready .Content .TableContainer .Table1,
body.nebra-v2-ready .Content .TableContainer .Table2,
body.nebra-v2-ready .Content .TableContainer .Table3,
body.nebra-v2-ready .Content .TableContainer .Table4,
body.nebra-v2-ready .Content .TableContainer .Table5,
body.nebra-v2-ready .Content .TableContent,
body.nebra-v2-ready .Content .TableContent tbody,
body.nebra-v2-ready .Content .TableContentContainer {
  background: transparent !important;
}
body.nebra-v2-ready .Content .TableContentContainer {
  border: 0 !important;
  box-shadow: none !important;
  overflow-x: auto !important;
}
body.nebra-v2-ready .Content .TableContent {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  color: var(--n4-text) !important;
}
body.nebra-v2-ready .Content .TableContent > tbody > tr > td,
body.nebra-v2-ready .Content .TableContent > thead > tr > th,
body.nebra-v2-ready .Content .TableContainer .Odd > td,
body.nebra-v2-ready .Content .TableContainer .Even > td {
  padding: 9px 10px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(244,199,104,.10) !important;
  color: var(--n4-text) !important;
  background: rgba(255,255,255,.025) !important;
}
body.nebra-v2-ready .Content .TableContent > tbody > tr:nth-child(even) > td {
  background: rgba(255,255,255,.048) !important;
}
body.nebra-v2-ready .Content .TableContent > tbody > tr:hover > td {
  background: rgba(126,42,25,.20) !important;
}
body.nebra-v2-ready .Content .TableContent th,
body.nebra-v2-ready .Content .TableContent .LabelH,
body.nebra-v2-ready .Content .TableContent .LabelH td {
  color: #ffe7ad !important;
  background: linear-gradient(180deg, rgba(84,35,23,.92), rgba(47,25,19,.94)) !important;
}
body.nebra-v2-ready .Content table[bgcolor] td,
body.nebra-v2-ready .Content tr[bgcolor] > td,
body.nebra-v2-ready .Content td[bgcolor] {
  color: var(--n4-text) !important;
  background: rgba(26,19,15,.94) !important;
}

/* Simple pages (Commands and old plugin tables) are not always wrapped in TableContainer. */
body.nebra-page-commands .BoxContent > table,
body.nebra-v2-ready .BoxContent > table.NebraV4DataTable {
  width: 100% !important;
  margin: 4px 0 12px !important;
  border: 1px solid var(--n4-border) !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: rgba(12,9,8,.94) !important;
}
body.nebra-page-commands .BoxContent > table td,
body.nebra-v2-ready .BoxContent > table.NebraV4DataTable td {
  padding: 10px 12px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(244,199,104,.12) !important;
  color: #f7ecdd !important;
  background: rgba(255,255,255,.026) !important;
}
body.nebra-page-commands .BoxContent > table tr:nth-child(even) td,
body.nebra-v2-ready .BoxContent > table.NebraV4DataTable tr:nth-child(even) td {
  background: rgba(255,255,255,.05) !important;
}
body.nebra-page-commands .BoxContent > table tr:first-child td,
body.nebra-v2-ready .BoxContent > table.NebraV4DataTable tr:first-child td {
  color: #ffe6a7 !important;
  background: linear-gradient(90deg, rgba(91,30,20,.96), rgba(45,23,17,.96)) !important;
  font-weight: 800 !important;
}

/* News / article tables: keep them readable and consistent. */
body.nebra-page-news .Content .BoxContent table:not(.NebraInventoryTable),
body.nebra-page-newsarchive .Content .BoxContent table:not(.NebraInventoryTable) {
  color: var(--n4-text);
}
body.nebra-page-news .Content .BoxContent table td,
body.nebra-page-newsarchive .Content .BoxContent table td {
  border-color: rgba(244,199,104,.22) !important;
}

/* ========================================================================== */
/* 4. FORMS                                                                      */
/* ========================================================================== */
body.nebra-v2-ready .Content input:not([type="image"]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
body.nebra-v2-ready .Content textarea,
body.nebra-v2-ready .Content select {
  min-height: 36px;
  padding: 7px 10px !important;
  border: 1px solid rgba(244,199,104,.42) !important;
  border-radius: 8px !important;
  background: rgba(7,6,5,.94) !important;
  color: #fff2df !important;
  font-size: 13px !important;
}
body.nebra-v2-ready .Content input:focus,
body.nebra-v2-ready .Content textarea:focus,
body.nebra-v2-ready .Content select:focus {
  border-color: #e8b657 !important;
  box-shadow: 0 0 0 3px rgba(232,182,87,.12) !important;
  outline: none !important;
}

/* ========================================================================== */
/* 5. CHARACTER PAGE — make outfit/inventory actually visible                   */
/* ========================================================================== */
body.nebra-page-characters .NebraInventoryTable {
  max-width: 360px !important;
  margin: 0 auto !important;
  border: 1px solid var(--n4-border-strong) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: linear-gradient(155deg, rgba(42,29,23,.98), rgba(17,13,11,.98)) !important;
}
body.nebra-page-characters .NebraInventoryTable > tbody > tr:first-child > td {
  padding: 10px !important;
  color: #ffe5a5 !important;
  background: rgba(91,31,20,.76) !important;
  font-size: 14px !important;
}
body.nebra-page-characters .NebraInventoryTable > tbody > tr:nth-child(2) > td {
  padding: 14px !important;
  background: rgba(12,10,9,.82) !important;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] {
  width: 196px !important;
  border-collapse: separate !important;
  border-spacing: 4px !important;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] > tbody > tr > td {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] table {
  border-collapse: separate !important;
  border-spacing: 3px !important;
  background: transparent !important;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] table td {
  box-sizing: border-box !important;
  width: 52px !important;
  height: 52px !important;
  padding: 2px !important;
  border: 1px solid rgba(244,199,104,.34) !important;
  border-radius: 7px !important;
  background: linear-gradient(145deg, #30251f, #181412) !important;
  text-align: center !important;
  vertical-align: middle !important;
  overflow: hidden !important;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] table td img {
  width: 46px !important;
  height: 46px !important;
  max-width: 46px !important;
  object-fit: contain !important;
  image-rendering: pixelated;
}
body.nebra-page-characters .NebraInventoryTable table[width="100"] table tr:last-child td {
  height: 34px !important;
  color: #f6e8d1 !important;
  font-size: 10px !important;
}
body.nebra-page-characters .NebraCurrentOutfitTable img[alt="player outfit"] {
  width: 104px !important;
  height: 104px !important;
  margin: -28px 0 0 -25px !important;
  image-rendering: pixelated;
}

/* ========================================================================== */
/* 6. POLISH FOR SMALL OLD PLUGIN CARDS                                         */
/* ========================================================================== */
body.nebra-v2-ready .Content .HeadlessTable,
body.nebra-v2-ready .Content .NebraV4Card {
  border: 1px solid var(--n4-border) !important;
  border-radius: 10px !important;
  background: rgba(16,12,10,.88) !important;
  color: var(--n4-text) !important;
}

@media (max-width: 820px) {
  body.nebra-v2-ready .Content .BoxContent { font-size: 13px !important; }
  body.nebra-v2-ready .Content .BoxContent td { font-size: 12.5px !important; }
  body.nebra-page-characters .NebraInventoryTable { max-width: 100% !important; }
}
