html.personal-app,
html.personal-app body {
  min-height: 100%;
  background: #0b0b0b;
}

html.personal-app body > :not(#adminDialog):not(#roleScreen):not(#personalRoleBar):not(.toast):not(script) {
  display: none !important;
}

html.personal-app #adminDialog {
  display: none;
}

html.personal-app #adminDialog[open] {
  display: block;
  padding: 0 !important;
}

html.personal-app #adminDialog::backdrop {
  background: #0b0b0b;
}

html.personal-app .admin-panel {
  width: 100% !important;
  max-width: none !important;
  min-height: 100dvh;
  max-height: none;
  border-radius: 0;
  padding: calc(84px + env(safe-area-inset-top)) 18px 28px !important;
}

html.personal-app #closeAdmin,
html.personal-app .admin-tabs {
  display: none !important;
}

html.personal-app.personal-role-general .admin-tabs {
  position: sticky;
  top: calc(62px + env(safe-area-inset-top));
  z-index: 55;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px;
  overflow: visible;
  margin: 4px 0 18px;
  padding: 12px;
  border: 1px solid #343434;
  border-radius: 16px;
  background: rgba(11,11,11,.97);
}

html.personal-app.personal-role-general .admin-tabs button {
  width: auto !important;
  min-width: 0 !important;
  min-height: 46px;
  padding: 9px 8px !important;
  border-width: 1px;
  border-radius: 12px;
  font-size: .88rem;
  white-space: normal;
}

.admin-back-to-roles {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 14px;
  z-index: 70;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid #d6a44e;
  border-radius: 12px;
  background: #d6a44e;
  color: #17120f;
  font-weight: 900;
}

.role-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top, rgba(214,164,78,.22), transparent 42%),
    #0b0b0b;
  color: #fff;
}

.role-screen[hidden] {
  display: none;
}

.role-card {
  width: min(520px, 100%);
  padding: 26px;
  border: 1px solid #39332c;
  border-radius: 26px;
  background: #151515;
  box-shadow: 0 24px 70px rgba(0,0,0,.48);
}

.role-logo {
  display: block;
  width: min(240px, 72%);
  margin: 0 auto 18px;
}

.role-card h1 {
  margin: 0;
  color: #fff;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.5rem, 11vw, 4.2rem);
  line-height: .95;
  text-align: center;
  text-transform: uppercase;
}

.role-card > p {
  margin: 12px 0 22px;
  color: #cfc6bb;
  text-align: center;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.role-button {
  min-height: 82px;
  border: 2px solid #3a3a3a;
  border-radius: 16px;
  background: #202020;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.role-button[data-personal-role="kitchen"] { border-color: #ef4444; }
.role-button[data-personal-role="bar"] { border-color: #3b82f6; }
.role-button[data-personal-role="waiter"] { border-color: #f59e0b; }
.role-button[data-personal-role="cash"] { border-color: #22c55e; }
.role-button[data-personal-role="general"] {
  grid-column: 1 / -1;
  border-color: #d6a44e;
  background: #d6a44e;
  color: #17120f;
}

.personal-role-bar {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 9px 14px;
  border-bottom: 1px solid #343434;
  background: rgba(8,8,8,.96);
  color: #fff;
}

.personal-role-bar[hidden] {
  display: none;
}

.personal-role-bar strong {
  color: #d6a44e;
  text-transform: uppercase;
}

.personal-role-bar button {
  border: 1px solid #d6a44e;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  padding: 9px 11px;
  font-weight: 800;
}

.admin-table-control {
  margin: 18px 0 24px;
  padding: 16px;
  border: 2px solid #d6a44e;
  border-radius: 20px;
  background: #151515;
}

.admin-table-control__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: #fff;
}

.admin-table-control__head div {
  display: grid;
  gap: 4px;
}

.admin-table-control__head strong {
  color: #d6a44e;
  font-size: 1.05rem;
}

.admin-table-control__head span {
  color: #cfc6bb;
  font-size: .86rem;
}

.admin-table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-table-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #353535;
  border-radius: 14px;
  background: #202020;
}

.admin-table-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #fff;
}

.admin-table-card span {
  color: #8ee59f;
  font-size: .7rem;
  font-weight: 900;
}

.admin-table-card.has-order span { color: #ffd36b; }
.admin-table-card.is-open span { color: #79b8ff; }

.admin-table-card button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: #d6a44e;
  color: #17120f;
  font-weight: 900;
}

.admin-table-card button.close-table {
  background: #c53b36;
  color: #fff;
}

.no-activity-note {
  color: #cfc6bb;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin: 14px 0;
}

.admin-kpi {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid #353535;
  border-radius: 14px;
  background: #181818;
  color: #cfc6bb;
}

.admin-kpi strong { color: #fff; font-size: 1.6rem; }
.admin-kpi.is-alert strong { color: #ffcc66; }
.admin-kpi.is-ok strong { color: #77df91; }

.admin-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 10px;
  color: #fff;
}

.history-toolbar {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.history-toolbar input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid #444;
  border-radius: 12px;
  background: #171717;
  color: #fff;
}

.history-card { opacity: .92; }
.owner-tools {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #383838;
}

.owner-tools__title {
  color: #d6a44e;
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.owner-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.owner-state-grid label {
  display: grid;
  gap: 5px;
  color: #cfc6bb;
  font-size: .78rem;
  font-weight: 800;
}

.owner-state-grid select {
  width: 100%;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid #4a4a4a;
  border-radius: 9px;
  background: #111;
  color: #fff;
}

.owner-item-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.owner-item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #111;
}

.owner-item-list li.is-cancelled {
  opacity: .62;
  text-decoration: line-through;
}

.owner-item-list button,
.history-card button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: #a6302d;
  color: #fff;
  font-weight: 900;
}

.owner-confirm-pay {
  min-height: 40px;
  border: 1px solid #d6a44e;
  border-radius: 9px;
  background: transparent;
  color: #d6a44e;
  font-weight: 900;
}

html.personal-app .admin-actions button,
html.personal-app .service-alert > button {
  width: 100%;
  min-height: 54px;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  background: #d6a44e;
  color: #17120f;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

html.personal-app .admin-actions button:not(.accept-order) {
  background: #22c55e;
  color: #07150b;
}

.owner-audit {
  display: grid;
  gap: 4px;
  margin: 3px 0 0;
  color: #aaa;
  font-size: .78rem;
}

.owner-audit strong { color: #d6a44e; }
.history-card li.is-cancelled {
  opacity: .62;
  text-decoration: line-through;
}

.history-card .reopen-table {
  margin-top: 10px;
  background: #d6a44e;
  color: #17120f;
}

html.personal-app .admin-actions .pay-order {
  background: #22c55e !important;
  color: #071b0d !important;
  font-weight: 950;
}

html.personal-app .admin-actions .cancel-full-order {
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: 950;
}
.connection-ok { color: #77df91 !important; }
.connection-local { color: #ffcc66 !important; }

@media (max-width: 420px) {
  .role-card { padding: 21px 16px; }
  .role-grid { grid-template-columns: 1fr; }
  .role-button[data-personal-role="general"] { grid-column: auto; }
  .admin-table-control__head { display: grid; }
}

@media (max-width: 760px) {
  html.personal-app.personal-role-general .admin-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    padding: 9px;
  }

  html.personal-app.personal-role-general .admin-tabs button {
    min-height: 48px;
    font-size: .82rem;
  }

  .admin-back-to-roles {
    right: 14px;
    width: calc(100% - 28px);
  }
}

@media (min-width: 700px) {
  .admin-table-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-kpis { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
