:root {
  --bg: #090a0d;
  --panel: #101217;
  --panel-soft: #151924;
  --line: #2f313a;
  --text: #f4f5f8;
  --muted: #b9beca;
  --gold: #c9a35b;
  --gold-soft: #e0c287;
  --danger: #d97272;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.btn-line,
.btn-gold {
  border-radius: 11px;
  border: 1px solid rgba(201, 163, 91, 0.52);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-line:hover,
.btn-gold:hover {
  border-color: rgba(224, 194, 135, 0.9);
}

.btn-gold {
  border: 0;
  color: #16191f;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  font-weight: 700;
}

.btn-line.danger {
  border-color: rgba(217, 114, 114, 0.65);
  color: #ffd3d3;
}

.cloud-auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 8%, rgba(201, 163, 91, 0.24), transparent 35%),
    radial-gradient(circle at 84% 18%, rgba(201, 163, 91, 0.18), transparent 28%),
    var(--bg);
}

.cloud-auth-shell {
  width: min(94vw, 460px);
}

.cloud-auth-card {
  border: 1px solid rgba(201, 163, 91, 0.35);
  background: linear-gradient(145deg, rgba(17, 20, 28, 0.96), rgba(10, 12, 17, 0.98));
  border-radius: 20px;
  padding: 26px;
}

.cloud-auth-card h1 {
  margin: 0;
  color: var(--gold-soft);
  font-size: 1.55rem;
}

.cloud-auth-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.cloud-auth-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.cloud-auth-form label {
  display: grid;
  gap: 6px;
}

.cloud-auth-form input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(201, 163, 91, 0.35);
  background: rgba(10, 12, 18, 0.9);
  color: var(--text);
  padding: 0 12px;
}

.cloud-auth-form button {
  margin-top: 4px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  color: #15171c;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
}

.cloud-auth-links {
  margin-top: 12px;
  display: flex;
  justify-content: stretch;
}

.cloud-auth-link {
  width: 100%;
  min-height: 42px;
  font-weight: 700;
}

.auth-message {
  margin-top: 10px;
  min-height: 1.5rem;
  color: #bbf0d3;
}

.auth-message.error {
  color: #ffbfbf;
}

.cloud-app-page,
.cloud-admin-page {
  min-height: 100vh;
}

.cloud-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px 1fr;
}

.tg-sidebar {
  border-right: 1px solid rgba(201, 163, 91, 0.2);
  background: linear-gradient(160deg, rgba(16, 18, 25, 0.96), rgba(12, 14, 20, 0.96));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
}

.tg-sidebar-top {
  padding: 14px;
  border-bottom: 1px solid rgba(201, 163, 91, 0.16);
  display: grid;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #171a1f;
  font-weight: 700;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
}

.user-pill strong {
  display: block;
  font-size: 0.96rem;
}

.user-pill small {
  color: var(--muted);
  font-size: 0.8rem;
}

.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-actions .btn-line {
  flex: 1 1 calc(50% - 8px);
  min-width: 0;
}

.tg-tabs {
  display: flex;
  border-bottom: 1px solid rgba(201, 163, 91, 0.14);
}

.tab-btn {
  flex: 1;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 11px 10px;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  color: var(--gold-soft);
  border-bottom-color: var(--gold);
}

.tab-content {
  display: none;
  overflow: auto;
}

.tab-content.active {
  display: block;
}

.stream-side-note {
  margin: 12px;
  padding: 14px;
  border: 1px solid rgba(201, 163, 91, 0.24);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(201, 163, 91, 0.12));
  display: grid;
  gap: 12px;
}

.stream-side-kicker,
.stream-card-kicker {
  margin: 0;
  color: var(--gold-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stream-side-note h3,
.stream-hub-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.stream-side-note p:not(.stream-side-kicker),
.stream-hub-card p:not(.stream-card-kicker),
.workspace-hub-head p:not(.stream-side-kicker) {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.stream-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stream-side-actions .btn-line,
.stream-side-actions .btn-gold {
  min-height: 40px;
}

.workspace-hub {
  padding: 20px 18px 24px;
  display: grid;
  gap: 14px;
}

.workspace-hub-head h2 {
  margin: 6px 0 0;
  color: var(--gold-soft);
  font-size: 1.26rem;
}

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

.stream-hub-card {
  border: 1px solid rgba(201, 163, 91, 0.24);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(201, 163, 91, 0.12));
  padding: 16px;
  display: grid;
  gap: 12px;
}

.stream-jump-form {
  display: grid;
  gap: 8px;
}

.stream-jump-form label {
  color: var(--gold-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.stream-jump-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.stream-jump-row input {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(201, 163, 91, 0.33);
  background: rgba(10, 12, 18, 0.92);
  color: var(--text);
  padding: 0 10px;
}

.chat-list {
  display: grid;
  gap: 1px;
}

.chat-item {
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.chat-item:hover,
.chat-item.active {
  background: rgba(201, 163, 91, 0.09);
}

.chat-item h4 {
  margin: 0;
  font-size: 0.93rem;
}

.chat-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  color: #99a0ae;
}

.chat-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.unread-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(201, 163, 91, 0.18);
  border: 1px solid rgba(201, 163, 91, 0.34);
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.files-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px;
  display: flex;
  gap: 8px;
  background: rgba(15, 18, 25, 0.95);
  border-bottom: 1px solid rgba(201, 163, 91, 0.14);
}

.file-list {
  padding: 10px;
  display: grid;
  gap: 9px;
}

.file-item {
  border: 1px solid rgba(201, 163, 91, 0.2);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.file-item h4 {
  margin: 0;
  font-size: 0.84rem;
}

.file-item .muted {
  color: var(--muted);
  font-size: 0.76rem;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(201, 163, 91, 0.14);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-footer .btn-line {
  flex: 1;
}

.tg-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    radial-gradient(circle at 93% 8%, rgba(201, 163, 91, 0.12), transparent 30%),
    linear-gradient(140deg, rgba(12, 14, 20, 0.98), rgba(9, 10, 15, 0.98));
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(201, 163, 91, 0.17);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.chat-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.chat-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notification-wrap {
  position: relative;
}

.notification-bell {
  position: relative;
  min-width: 46px;
  min-height: 42px;
  padding: 0 12px;
}

.notification-bell-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.notification-bell-icon svg {
  width: 100%;
  height: 100%;
}

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  color: #15171c;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(201, 163, 91, 0.22);
}

.notification-badge.hidden {
  display: none;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, 82vw);
  max-height: min(68vh, 520px);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(201, 163, 91, 0.28);
  background: linear-gradient(150deg, rgba(16, 19, 26, 0.98), rgba(10, 12, 18, 0.99));
  box-shadow: 0 28px 48px rgba(0, 0, 0, 0.42);
  z-index: 30;
}

.notification-panel.hidden {
  display: none;
}

.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(201, 163, 91, 0.16);
}

.notification-panel-head strong {
  color: var(--gold-soft);
}

.notification-list {
  display: grid;
  max-height: inherit;
  overflow: auto;
}

.notification-empty {
  padding: 16px 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.notification-item {
  border: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.notification-item:hover {
  background: rgba(201, 163, 91, 0.08);
}

.notification-item:last-child {
  border-bottom: 0;
}

.notification-item strong {
  font-size: 0.84rem;
}

.notification-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.notification-item span {
  color: #99a0ae;
  font-size: 0.72rem;
}

.notification-toasts {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.notification-toast {
  width: min(360px, calc(100vw - 32px));
  border-radius: 16px;
  border: 1px solid rgba(201, 163, 91, 0.32);
  background: linear-gradient(145deg, rgba(16, 19, 26, 0.96), rgba(10, 12, 18, 0.98));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.42);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.notification-toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.notification-toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-toast-head strong {
  color: var(--gold-soft);
  font-size: 0.84rem;
}

.notification-toast-head span {
  color: #99a0ae;
  font-size: 0.72rem;
}

.notification-toast p {
  margin: 0;
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.6;
}

.notification-toast-actions {
  display: flex;
  justify-content: flex-end;
}

.chat-area {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 14px 18px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.msg {
  max-width: min(74%, 700px);
  border-radius: 14px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.05);
  justify-self: start;
}

.msg.me {
  justify-self: end;
  background: linear-gradient(140deg, rgba(201, 163, 91, 0.3), rgba(201, 163, 91, 0.16));
  border-color: rgba(201, 163, 91, 0.52);
}

.msg .author {
  font-size: 0.72rem;
  color: #d5bb87;
  margin-bottom: 4px;
}

.msg .body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.6;
}

.msg-attachment {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(201, 163, 91, 0.2);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 8px;
}

.msg-attachment.is-voice {
  background: rgba(201, 163, 91, 0.08);
}

.msg-attachment-meta {
  display: grid;
  gap: 3px;
}

.msg-attachment-meta strong {
  font-size: 0.83rem;
}

.msg-attachment-meta span {
  color: var(--muted);
  font-size: 0.74rem;
}

.msg-attachment-btn {
  justify-self: start;
}

.msg-audio {
  width: min(100%, 320px);
}

.msg .time {
  margin-top: 6px;
  font-size: 0.7rem;
  color: #9da5b2;
  text-align: right;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(201, 163, 91, 0.18);
  background: rgba(11, 13, 18, 0.96);
}

.composer-main {
  display: grid;
  gap: 8px;
}

.composer-actions {
  display: grid;
  align-content: end;
  gap: 8px;
}

.composer-attachment-preview.hidden {
  display: none;
}

.composer-attachment-card {
  border: 1px solid rgba(201, 163, 91, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.composer-attachment-card.is-voice {
  background: rgba(201, 163, 91, 0.08);
}

.composer-attachment-meta {
  display: grid;
  gap: 4px;
}

.composer-attachment-meta strong {
  font-size: 0.84rem;
}

.composer-attachment-meta span {
  color: var(--muted);
  font-size: 0.76rem;
}

.composer-attachment-card audio {
  width: min(100%, 320px);
}

.composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 170px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(201, 163, 91, 0.35);
  background: rgba(10, 12, 18, 0.9);
  color: var(--text);
  padding: 10px 12px;
}

.composer .btn-gold {
  min-width: 102px;
}

.empty-state {
  display: none;
  padding: 34px 20px;
}

.empty-state.active {
  display: block;
}

.empty-state h2 {
  margin: 0;
  color: var(--gold-soft);
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 8, 12, 0.85);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(720px, 96vw);
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(201, 163, 91, 0.4);
  background: linear-gradient(150deg, rgba(16, 19, 26, 0.98), rgba(10, 12, 18, 0.99));
  position: relative;
  padding: 18px;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(201, 163, 91, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.modal-body-grid {
  display: grid;
  gap: 10px;
}

.modal-body-grid label {
  display: grid;
  gap: 6px;
}

.modal-body-grid input,
.modal-body-grid textarea,
.modal-body-grid select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(201, 163, 91, 0.33);
  background: rgba(10, 12, 18, 0.92);
  color: var(--text);
  padding: 9px 10px;
}

.upload-progress-wrap {
  display: grid;
  gap: 8px;
}

.upload-progress-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(201, 163, 91, 0.32);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.upload-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(120deg, var(--gold), var(--gold-soft));
  transition: width 0.22s ease;
}

.modal-members {
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(201, 163, 91, 0.2);
  border-radius: 12px;
}

.modal-member-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-member-row:last-child {
  border-bottom: 0;
}

.modal-subtitle {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.7;
}

.password-warning {
  border: 1px solid rgba(201, 163, 91, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--gold-soft);
  background: rgba(201, 163, 91, 0.08);
}

.admin-shell {
  width: min(1360px, 96vw);
  margin: 18px auto;
  display: grid;
  gap: 14px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(201, 163, 91, 0.3);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(140deg, rgba(15, 18, 24, 0.97), rgba(10, 12, 18, 0.98));
}

.admin-topbar h1 {
  margin: 0;
  color: var(--gold-soft);
}

.admin-topbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.admin-top-actions {
  display: flex;
  gap: 8px;
}

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

.stat-card {
  border: 1px solid rgba(201, 163, 91, 0.25);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.stat-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.3rem;
  color: var(--gold-soft);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 12px;
}

.admin-card {
  border: 1px solid rgba(201, 163, 91, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  padding: 14px;
}

.admin-card h2 {
  margin: 0 0 10px;
  color: var(--gold-soft);
  font-size: 1.02rem;
}

.admin-form {
  display: grid;
  gap: 8px;
}

.permission-grid-field {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(201, 163, 91, 0.18);
  border-radius: 12px;
}

.permission-grid-field legend {
  padding: 0 8px;
  color: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

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

.permission-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(201, 163, 91, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.permission-card.is-disabled {
  opacity: 0.7;
}

.permission-card input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.permission-card strong {
  display: block;
  font-size: 0.83rem;
}

.permission-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-form label {
  display: grid;
  gap: 5px;
  font-size: 0.84rem;
}

.admin-form input,
.admin-form select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(201, 163, 91, 0.33);
  background: rgba(10, 12, 18, 0.92);
  color: var(--text);
  padding: 0 10px;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.share-user-row {
  width: 100%;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.share-user-row:last-child {
  border-bottom: 0;
}

.admin-message {
  margin-top: 8px;
  min-height: 1.4rem;
  color: #bdeece;
}

.admin-message.error {
  color: #ffbdbd;
}

.user-row-stack {
  display: grid;
  gap: 6px;
}

.user-row-stack small {
  color: var(--muted);
}

.perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(201, 163, 91, 0.22);
  background: rgba(201, 163, 91, 0.08);
  color: var(--gold-soft);
  font-size: 0.7rem;
}

.muted-chip {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(201, 163, 91, 0.14);
  text-align: left;
  font-size: 0.82rem;
}

.admin-table th {
  color: var(--gold-soft);
  background: rgba(201, 163, 91, 0.08);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(201, 163, 91, 0.35);
  padding: 3px 9px;
  font-size: 0.72rem;
}

.badge.success {
  border-color: rgba(111, 217, 158, 0.6);
  color: #c5f7df;
  background: rgba(36, 144, 93, 0.2);
}

.badge.warn {
  border-color: rgba(240, 182, 101, 0.56);
  color: #ffe5b8;
  background: rgba(209, 139, 41, 0.2);
}

.badge.danger {
  border-color: rgba(236, 112, 112, 0.6);
  color: #ffc8c8;
  background: rgba(176, 52, 52, 0.24);
}

.admin-modal-card {
  width: min(860px, 96vw);
}

.admin-modal-grid {
  display: grid;
  gap: 16px;
}

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

.admin-check-grid {
  display: grid;
  gap: 8px;
}

.admin-reset-form {
  padding-top: 12px;
  border-top: 1px solid rgba(201, 163, 91, 0.14);
}

.feature-gate {
  border: 1px solid rgba(201, 163, 91, 0.24);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(201, 163, 91, 0.08));
}

@media (max-width: 1100px) {
  .cloud-app {
    grid-template-columns: 320px 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .permissions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .cloud-app {
    grid-template-columns: 1fr;
  }

  .tg-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(201, 163, 91, 0.22);
    max-height: 52vh;
  }

  .chat-header {
    padding: 12px;
  }

  .messages {
    padding: 12px;
  }

  .msg {
    max-width: 88%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: stretch;
  }

  .stream-hub-grid {
    grid-template-columns: 1fr;
  }

  .notification-panel {
    left: 0;
    right: auto;
    width: min(420px, calc(100vw - 32px));
  }
}

@media (max-width: 520px) {
  .cloud-auth-card,
  .modal-card,
  .admin-topbar,
  .admin-card {
    padding: 12px;
  }

  .chat-header h1 {
    font-size: 1.04rem;
  }

  .chat-header p {
    font-size: 0.78rem;
  }

  .notification-toasts {
    right: 12px;
    left: 12px;
  }

  .notification-toast {
    width: 100%;
  }

  .sidebar-actions .btn-line {
    flex: 1 1 100%;
  }

  .sidebar-footer .btn-line {
    flex: 1 1 100%;
  }

  .composer-actions {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-two-col {
    grid-template-columns: 1fr;
  }

  .stream-side-actions,
  .stream-jump-row {
    grid-template-columns: 1fr;
  }

  .stream-side-actions .btn-line,
  .stream-side-actions .btn-gold,
  .stream-jump-row .btn-line {
    width: 100%;
  }
}
