/* Admin panel */
body { font-size: 14px; }
.small { font-size: 12px; }
[hidden] { display: none !important; }

input, select, textarea {
  background: #161618; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: #d4d4d8; }
label.inline { flex-direction: row; align-items: center; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; }
.row > input:not(.narrow):not(.narrow2) { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { width: 90px; }
.narrow2 { width: 140px; }
.wide { width: 100%; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; padding: 34px 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.login-card h1 { margin: 6px 0 0; font-size: 24px; font-weight: 400; }
.login-card p { margin: 0 0 8px; }
.login-card input, .login-card .btn { width: 100%; }
.login-err { color: var(--bad); min-height: 20px; margin: 0; }

/* layout */
.app { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 64px 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line-2); background: #141415; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand img { width: 30px; height: 30px; }
.brand .mc span { color: var(--accent-2); }
.brand em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
.server-pill { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: #1c1c1e; border: 1px solid var(--line); font-weight: 600; }
.top-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.top-stats b { color: var(--text); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pending { font-size: 12px; color: var(--warn); animation: pulse 1.4s infinite; }

.side { padding: 16px 12px; border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; position: sticky; top: 64px; height: calc(100vh - 64px); }
.side button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: none; border: 0; color: var(--muted); font-weight: 600; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.side button i { font-style: normal; width: 20px; text-align: center; opacity: .8; font-family: var(--mc); }
.side button:hover { background: #1c1c1e; color: var(--text); }
.side button.active { background: var(--accent-soft); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.main { padding: 26px 30px 60px; min-width: 0; }
.main h1 { margin: 0 0 20px; font-size: 24px; font-weight: 400; }
.tab { animation: fadeUp .3s ease both; }

.offline-banner { margin-bottom: 20px; padding: 14px 18px; border-radius: 12px; background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .3); color: #fecaca; }

.panel { background: var(--card); border: 1px solid #262629; border-radius: 16px; padding: 20px; margin-bottom: 20px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .panel, .grid-2 > .stack > .panel { margin-bottom: 0; }
.grid-2 { margin-bottom: 20px; }

/* stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--card); border: 1px solid #262629; border-radius: 14px; padding: 16px 18px; }
.card > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.card b { display: block; margin-top: 6px; font: 400 22px/1.2 var(--mc); }
.card small { color: var(--dim); }
.bar-meter { height: 6px; border-radius: 4px; background: #2a2a2e; margin-top: 10px; overflow: hidden; }
.bar-meter i { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .4s; }
.small-cards .card b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* chart */
.chart { width: 100%; height: 160px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar.zero { fill: #3a3a3f; }
.chart .gap { fill: rgba(248, 113, 113, .25); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; margin-top: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid #252528; white-space: nowrap; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #222225; }
.table .empty-row td { color: var(--muted); text-align: center; padding: 24px; white-space: normal; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.who img { width: 26px; height: 26px; border-radius: 5px; image-rendering: pixelated; background: #000; }
.rank-badge { font: 11px var(--mc); padding: 2px 7px; border-radius: 5px; background: rgba(255, 255, 255, .06); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #2a2a2e; color: var(--muted); }
.pill.ok { background: rgba(74, 222, 128, .12); color: var(--ok); }
.pill.bad { background: rgba(248, 113, 113, .12); color: var(--bad); }
.pill.warn { background: rgba(251, 191, 36, .12); color: var(--warn); }
.mini-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.mini-list .who { padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.mini-list .who:hover { background: #232326; }
.mini-list .who .muted { margin-left: auto; font-weight: 400; font-size: 12px; }
.msg-cell { white-space: normal !important; max-width: 420px; color: #d4d4d8; }

/* give items */
.give-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
.give-layout > .panel { margin-bottom: 20px; }
#item-search { width: 100%; margin-bottom: 14px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; max-height: 520px; overflow-y: auto; padding: 2px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 8px; background: #8b8b8b; box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; display: grid; place-items: center; cursor: pointer; border: 0; padding: 0; }
.item-grid .slot { background: #2a2a2e; box-shadow: none; border: 1px solid #333338; transition: border-color .12s, background .12s, transform .12s; }
.item-grid .slot:hover { border-color: #55555c; background: #333338; transform: scale(1.06); }
.item-grid .slot.sel { border-color: var(--accent); background: var(--accent-soft); }
.slot img { width: 70%; height: 70%; image-rendering: pixelated; pointer-events: none; }
.slot .noimg { font-size: 9px; color: var(--muted); text-align: center; padding: 2px; word-break: break-all; }
.slot .amt { position: absolute; right: 4px; bottom: 1px; font: 700 13px var(--mc); color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
.slot .ench-glint { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(120deg, transparent 30%, rgba(180, 120, 255, .35), transparent 70%); pointer-events: none; }
.slot .dura { position: absolute; left: 12%; right: 12%; bottom: 10%; height: 3px; background: #000; }
.slot .dura i { display: block; height: 100%; }
.selected-item { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: #161618; border: 1px solid var(--line); }
.slot.big { width: 64px; flex: none; background: #2a2a2e; box-shadow: none; border: 1px solid #333338; cursor: default; }
.give-form { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
.amount-row input { width: 90px; flex: none !important; }
.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.more summary { cursor: pointer; font-weight: 600; color: #d4d4d8; }
.more[open] { display: flex; flex-direction: column; gap: 12px; }
.more[open] summary { margin-bottom: 4px; }
.ench-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; color: #d4d4d8; }
.ench-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ench-row select { flex: 1; }
.ench-row input { width: 70px; }

/* console */
.console { display: flex; flex-direction: column; gap: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.console-out { margin: 0; height: 460px; overflow: auto; background: #0b0b0c; border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.console-out .cmd { color: var(--accent-2); }
.console-out .ok { color: #d4d4d8; }
.console-out .bad { color: var(--bad); }
.console-in { display: flex; align-items: center; gap: 10px; background: #0b0b0c; border: 1px solid var(--line-2); border-radius: 12px; padding: 6px 6px 6px 14px; }
.console-in input { flex: 1; background: none; border: 0; box-shadow: none !important; font-family: ui-monospace, Menlo, monospace; }
.console-in .mc { color: var(--accent-2); }

/* chat */
.chat-log { height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.chat-line { padding: 5px 8px; border-radius: 6px; }
.chat-line:hover { background: #222225; }
.chat-line time { color: var(--dim); font-size: 11px; margin-right: 8px; font-variant-numeric: tabular-nums; }
.chat-line b { margin-right: 6px; }
.chat-line.join { color: var(--ok); }
.chat-line.quit { color: var(--muted); }
.chat-line.death { color: #fca5a5; }

/* player drawer */
.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(760px, 100vw); max-width: 100vw; border: 0; padding: 0; background: #151516; color: var(--text); border-left: 1px solid var(--line); }
.drawer::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.drawer[open] { animation: slideIn .25s cubic-bezier(.22, 1, .36, 1); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line-2); }
.drawer-head img { border-radius: 8px; image-rendering: pixelated; background: #000; }
.drawer-head h2 { margin: 0; font-size: 22px; font-weight: 400; }
.drawer-head .btn { margin-left: auto; }
.drawer-tabs { display: flex; gap: 4px; padding: 10px 24px 0; border-bottom: 1px solid var(--line-2); }
.drawer-tabs button { padding: 10px 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.drawer-tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }
.pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pd-grid .row { flex-wrap: wrap; }
.pd-grid .row > select { flex: 1 1 90px; }
.drawer-body { overflow-x: hidden; }
.pd-grid .panel { margin: 0; }
.pd-grid .panel:has(#pd-reason), .pd-grid .panel:has(.row.wrap [data-pa]) { grid-column: 1 / -1; }
.danger-zone { border-color: rgba(248, 113, 113, .25) !important; }
.danger-zone .row + .row { margin-top: 10px; }

/* inventory */
.inv { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; padding: 12px; margin-top: 14px; background: #c6c6c6; border-radius: 6px; box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555; max-width: 520px; }
.inv .slot { border-radius: 0; cursor: pointer; }
.inv .slot.empty-slot { cursor: default; }
.inv .slot.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
.inv .sep { grid-column: 1 / -1; height: 8px; }
.inv .label { grid-column: 1 / -1; font: 12px var(--mc); color: #3f3f3f; }
.inv-detail { margin-top: 14px; max-width: 520px; }
.inv-detail .panel { margin: 0; display: flex; gap: 14px; align-items: center; }

/* confirm + toasts */
.confirm { border: 0; padding: 0; background: transparent; color: var(--text); width: min(420px, calc(100% - 32px)); }
.confirm::backdrop { background: rgba(0, 0, 0, .7); }
.confirm-inner { padding: 24px; }
.confirm-inner h3 { margin: 0 0 8px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: #232326; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); white-space: pre-wrap; animation: fadeUp .25s ease; font-size: 13px; }
.toast.ok { border-color: rgba(74, 222, 128, .4); }
.toast.bad { border-color: rgba(248, 113, 113, .5); }
.toast.wait { border-color: rgba(251, 191, 36, .4); }
.toast b { display: block; margin-bottom: 2px; }

@media (max-width: 1100px) {
  .grid-2, .give-layout { grid-template-columns: 1fr; }
  .give-form { position: static; }
  .top-stats { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 64px auto 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .side button { white-space: nowrap; }
  .main { padding: 20px 16px 60px; }
  .pd-grid { grid-template-columns: 1fr; }
  .server-pill { display: none; }
}
