/* ---------------------------------------------------------------------------
   SOP Manager - admin theme, styled to match the in-game SOPs UI.
   --------------------------------------------------------------------------- */
:root {
  --bg: radial-gradient(1200px 800px at 50% 0%, rgba(64, 64, 64, .2) 0%, rgba(10, 10, 10, .96) 100%), #080808;
  --panel: rgba(18, 18, 18, .93);
  --panel2: rgba(26, 29, 36, .9);
  --card: rgba(38, 38, 38, .5);
  --border: rgba(255, 255, 255, .1);
  --text: #ffffff;
  --muted: #9ca3af;
  --accent-grad: linear-gradient(135deg, #7c2d12 0%, #ea580c 60%, #fb923c 100%);
  --accent: #ea580c;
  --accent-soft: rgba(249, 115, 22, .25);
  --accent-border: rgba(251, 146, 60, .5);
  --green: #22c55e;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: #63b3ed;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 20px;
  margin: 0;
}
h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

code {
  background: rgba(255, 255, 255, .08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
}

/* ---------------- app shell ---------------- */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  min-height: 72px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(12, 12, 12, .98), rgba(30, 30, 30, .92), rgba(12, 12, 12, .98));
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  flex: none;
}
.title {
  font-weight: 700;
  line-height: 1.2;
}
.subtitle {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.who {
  color: var(--muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(12, 12, 12, .98), rgba(12, 12, 12, .96));
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 24px 40px;
}
.content.flush {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.foot {
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  background: rgba(12, 12, 12, .6);
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: rgba(255, 255, 255, .12);
  text-decoration: none;
}
.btn.active {
  background: linear-gradient(135deg, #7c2d12 0%, #ea580c 100%);
  border-color: var(--accent-border);
}
.btn-primary {
  background: var(--accent-grad);
  border-color: var(--accent-border);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.08);
  background: var(--accent-grad);
}
.btn-ghost {
  background: transparent;
}
.btn-block {
  width: 100%;
  height: 42px;
}
.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.btn-mini {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-mini:hover {
  background: rgba(255, 255, 255, .14);
  text-decoration: none;
}
.btn-mini.danger {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .4);
}
.btn-mini.danger:hover {
  background: rgba(239, 68, 68, .25);
}
.btn-mini.link {
  color: #fdba74;
  border-color: var(--accent-border);
}
.btn-danger {
  background: rgba(239, 68, 68, .18);
  border-color: rgba(248, 113, 113, .45);
  color: #fecaca;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, .3);
  filter: none;
}
.btn:disabled,
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* ---------------- registration toggle ---------------- */
.reg-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.reg-toggle-info code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .08);
  color: #fdba74;
}
.reg-toggle-form {
  margin: 0;
}
.icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: #fdba74;
  border-color: var(--accent-border);
}
.inline-form {
  display: inline-block;
  margin: 0;
  vertical-align: middle;
}

/* ---------------- alerts ---------------- */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .06);
}
.content.flush .alert {
  margin: 12px 16px 0;
}
.alert-success {
  background: rgba(34, 197, 94, .14);
  border-color: rgba(74, 222, 128, .4);
  color: #bbf7d0;
}
.alert-error {
  background: rgba(239, 68, 68, .16);
  border-color: rgba(248, 113, 113, .45);
  color: #fecaca;
}
.alert-info {
  background: rgba(59, 130, 246, .14);
  border-color: rgba(96, 165, 250, .4);
  color: #bfdbfe;
}

/* ---------------- forms ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field.grow {
  flex: 1;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font: inherit;
}
textarea {
  height: auto;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
select option {
  background: #1a1a1a;
  color: var(--text);
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  width: auto;
  height: auto;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
}
.filters .field {
  min-width: 150px;
}
.filters .actions {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------- split view (game style) ---------------- */
.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.content.flush .split {
  flex: 1;
}
.side {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow: hidden;
}
.side-top {
  display: flex;
  gap: 8px;
  align-items: center;
}
.side-top select {
  flex: 1;
}
.list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list::-webkit-scrollbar,
.vc::-webkit-scrollbar {
  width: 6px;
}
.list::-webkit-scrollbar-thumb,
.vc::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, .3);
  border-radius: 6px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .05);
}
.search i {
  color: var(--muted);
}
.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  height: auto;
  padding: 0;
  color: var(--text);
  font-size: 13px;
}
.search input:focus {
  box-shadow: none;
}

.item {
  position: relative;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(18, 18, 18, .45);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item:hover {
  border-color: rgba(255, 255, 255, .18);
}
.item.active {
  background: linear-gradient(90deg, rgba(249, 115, 22, .18), rgba(10, 10, 10, .6));
  border-color: rgba(251, 146, 60, .55);
}
.item-title {
  font-weight: 600;
  padding-right: 30px;
}
.item-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.item-move {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.item:hover .item-move {
  opacity: 1;
}
.item-move .inline-form {
  display: block;
}
.move-btn {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .08);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}
.move-btn:hover {
  background: rgba(249, 115, 22, .3);
  color: #fdba74;
  border-color: var(--accent-border);
}

.mainv {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.vh {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vt {
  font-size: 20px;
  font-weight: 700;
}
.vm {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.vh-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}
.vc {
  flex: 1;
  overflow: auto;
  padding: 18px 20px;
  line-height: 1.8;
  color: #fff;
}
.vc h1,
.vc h2 {
  color: #fff;
  margin: 6px 0;
}
.vc h3 {
  color: #fff;
  margin: 10px 0 6px;
}
.vc p {
  margin: 8px 0;
}
.vc ul,
.vc ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vc blockquote {
  padding: 12px 14px;
  border-left: 3px solid rgba(251, 146, 60, .55);
  border-radius: 0 10px 10px 0;
  background: rgba(249, 115, 22, .12);
  margin: 10px 0;
}
.vc hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, .12);
  margin: 12px 0;
}
.vc img {
  max-width: 100%;
  border-radius: 8px;
  margin: 0.5em 0;
}
.vc table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
}
.vc td,
.vc th {
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 5px 8px;
  vertical-align: top;
}
.vc th {
  background: rgba(255, 255, 255, .07);
  font-weight: 700;
  text-align: left;
}
.vc a {
  color: #63b3ed;
  text-decoration: underline;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 40px 24px;
}
.content:not(.flush) .empty {
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 48px 24px;
}

/* ---------------- tags / pills ---------------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
}
.tag-sop {
  background: rgba(59, 130, 246, .18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, .4);
}
.tag-training {
  background: rgba(16, 185, 129, .18);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, .4);
}
.tag-announcement {
  background: rgba(249, 115, 22, .2);
  color: #fed7aa;
  border-color: var(--accent-border);
}
.tag-rule {
  background: rgba(239, 68, 68, .18);
  color: #fecaca;
  border-color: rgba(248, 113, 113, .4);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid transparent;
}
.pill-pin {
  background: var(--accent-soft);
  color: #fdba74;
  border-color: var(--accent-border);
}
.pill-off {
  background: rgba(148, 163, 184, .2);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, .35);
}
.pill-you {
  background: rgba(34, 197, 94, .2);
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, .4);
}
.pill-super {
  background: rgba(168, 85, 247, .22);
  color: #e9d5ff;
  border-color: rgba(192, 132, 252, .45);
}
.pill-job {
  background: rgba(59, 130, 246, .18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, .4);
}
.job-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.jobs-check {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 0;
}

/* ---------------- tables ---------------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  vertical-align: middle;
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, .025);
}
.row-pinned td {
  background: rgba(249, 115, 22, .05);
}
.row-inactive {
  opacity: .6;
}
.col-order {
  width: 64px;
}
.col-center {
  text-align: center;
}
.col-actions {
  width: 1%;
  white-space: nowrap;
}
.row-title {
  font-weight: 600;
  color: var(--text);
}
.row-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head .muted {
  margin: 4px 0 0;
}

/* ---------------- pager ---------------- */
.pager {
  display: flex;
  gap: 6px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.page-link,
.page-current {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
}
.page-current {
  background: linear-gradient(135deg, #7c2d12 0%, #ea580c 100%);
  border-color: var(--accent-border);
  font-weight: 700;
}
.page-link:hover {
  background: rgba(255, 255, 255, .12);
  text-decoration: none;
}

/* ---------------- editor ---------------- */
.editor-form {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 20px;
}
.editor-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}
.editor-grid .field {
  min-width: 180px;
}
.editor-form > .field {
  margin-bottom: 14px;
}
.tox-tinymce {
  border-radius: 10px !important;
  border-color: rgba(255, 255, 255, .12) !important;
}

/* ---------------- cards / columns ---------------- */
.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  align-items: start;
}
.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  padding: 18px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cat-list,
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cat-row,
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: var(--panel2);
  flex-wrap: wrap;
}
.cat-row.editing {
  border-color: var(--accent-border);
  background: linear-gradient(90deg, rgba(249, 115, 22, .14), rgba(10, 10, 10, .3));
}
.cat-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: #fdba74;
}
.cat-name {
  font-weight: 600;
  flex: 1;
  min-width: 120px;
}
.cat-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
}
.user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.password-form {
  flex-basis: 100%;
  flex-direction: row;
  gap: 8px;
  margin-top: 6px;
}
.password-form input {
  height: 32px;
}

/* ---------------- auth pages ---------------- */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 24px;
  overflow: auto;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 20px;
}
.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-grad);
  font-size: 12px;
  letter-spacing: .5px;
  color: #fff;
}
.auth-title {
  margin-bottom: 16px;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}
.auth-form .btn {
  margin-top: 18px;
}

/* ---------------- responsive ---------------- */
@media (max-width: 860px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  header {
    flex-wrap: wrap;
    min-height: 0;
    padding: 12px 16px;
  }
  .content {
    padding: 18px 16px 40px;
  }
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 45%) minmax(0, 1fr);
  }
  .side {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
