/* Account shared header styles */
header {
  padding: 0;
  position: relative;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.3rem;
}

a {
  color: #fff;
}

a:hover {
    color: #6bb5f5;
}

.account-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 2rem;
  background: rgba(20, 20, 20, 0.85);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  height: 4rem;
}

.account-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.account-meta {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  padding: .45rem .65rem;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-bg);
}

.account-meta__label {
  opacity: .85;
  font-size: .85rem;
}

.account-meta__value {
  font-weight: 600;
  font-size: .9rem;
}

.account-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.account-menu-toggle {
  display: none;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.account-brand .logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.account-nav {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 0.8rem;
}

.account-nav-drawer {
  display: none;
}

.account-drawer-backdrop {
  display: none;
}

.account-nav a {
  color: var(--text-primary);
  text-decoration: none;
  padding: .45rem .8rem;
  border-radius: 8px;
  font-size: .9rem;
  border: 1px solid transparent;
}

.account-nav a:hover {
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
}

.account-nav a.active {
  color: #fff;
  border-color: var(--glass-border);
  background: rgb(14 109 231 / 25%);
}

.account-logout-btn {
  background: #9B4040FF;
  border: none;
  color: #fff;
  padding: .55rem .9rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.account-logout-btn:hover {
  filter: brightness(1.1);
}

.actions button {
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.actions button:hover {
  filter: brightness(1.1);
}

.account-container {
  padding: 1.25rem 2rem 2rem;
}

.account-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Account flash messages (shared) */
body.account-app .msg-ok {
  color: #6bff9e;
  font-size: .95rem;
  margin: .25rem 0 .75rem;
}

body.account-app .msg-err {
  color: #ff6b6b;
  font-size: .95rem;
  margin: .25rem 0 .75rem;
}

/* Account auth pages (login/register) */
body.account-auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.account-auth .page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem 1rem;
}

body.account-auth .login-box {
  max-width: 440px;
  width: 100%;
  padding: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

body.account-auth .login-box h1 {
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

body.account-auth .login-box form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

body.account-auth .login-box input {
  padding: .8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: #1f1f1f;
  color: var(--text-primary);
}

body.account-auth .link {
  color: var(--text-primary);
  opacity: .9;
  text-decoration: none;
  font-size: 0.9rem;
}

body.account-auth .link:hover {
  text-decoration: underline;
}

body.account-auth--login .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .9rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
  font-size: 0.9rem;
}

body.account-auth--login .btn--primary {
  border: none;
  background: var(--dark-blue);
  color: #fff;
}

body.account-auth--login .btn--primary:hover {
  filter: brightness(1.1);
}

body.account-auth--login .btn--muted {
  background: #1f1f1f;
  color: var(--text-primary);
  border-color: var(--glass-border);
  opacity: .9;
}

body.account-auth--login .btn--muted:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .05);
}

body.account-auth--login .actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: .75rem;
}

body.account-auth--login .actions .btn {
  flex: 1;
}

body.account-auth--login .error {
  color: #ff6b6b;
  font-size: .9rem;
  margin-bottom: .75rem;
}

body.account-auth--login .alt {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
}

body.account-auth--login .google-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: .9rem 1rem;
  border-radius: 8px;
  border: none;
  background: #0e6de7;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
}

body.account-auth--login .google-btn:hover {
  filter: brightness(1.1);
}

body.account-auth--login .register-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--glass-border);
  background: #1f1f1f;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
}

body.account-auth--login .register-btn:hover {
  background: rgba(255, 255, 255, .05);
}

body.account-auth--register .login-box button {
  padding: .9rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--dark-blue);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 120ms ease, filter 120ms ease, opacity 120ms ease;
  font-size: 0.9rem;
}

body.account-auth--register .login-box button:hover {
  filter: brightness(1.1);
}

body.account-auth--register .msg-ok {
  color: #6bff9e;
  font-size: .95rem;
  margin-bottom: .75rem;
}

body.account-auth--register .msg-err {
  color: #ff6b6b;
  font-size: .95rem;
  margin-bottom: .75rem;
}

/* Account page: account.php */
body.account-page--account .kv {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: .5rem 1rem;
  align-items: start;
}

@media (max-width: 520px) {
  body.account-page--account .kv {
    grid-template-columns: 1fr;
  }
}

body.account-page--account .k {
  opacity: .85;
}

body.account-page--account .form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1rem;
}

body.account-page--account .form label {
  font-size: .9rem;
  opacity: .9;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

body.account-page--account .form input {
  padding: .8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: #1f1f1f;
  color: var(--text-primary);
}

body.account-page--account .form button {
  padding: .9rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--dark-blue);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

body.account-page--account .form button:hover {
  filter: brightness(1.1);
}

/* Account page: favorites.php */
body.account-page--favorites .fav-id {
  font-weight: 800;
  margin: 0 0 .15rem;
  font-size: 1rem;
}

body.account-page--favorites .fav-title {
  opacity: .9;
  margin: 0 0 .5rem;
}

body.account-page--favorites .fav-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: .25rem .75rem;
  align-items: start;
  margin-top: .75rem;
}

body.account-page--favorites .k {
  opacity: .75;
  font-size: .85rem;
}

body.account-page--favorites .v {
  font-size: .9rem;
  word-break: break-word;
}

body.account-page--favorites .fav-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
  margin-top: .75rem;
}

body.account-page--favorites .fav-actions button {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: .5rem .75rem;
  border-radius: 10px;
  cursor: pointer;
}

body.account-page--favorites .fav-actions button:hover {
  background: rgba(255, 255, 255, .05);
}

body.account-page--favorites .fav-actions .fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: .5rem .75rem;
  border-radius: 10px;
  cursor: pointer;
}

body.account-page--favorites .fav-actions .fav-btn--series {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: .175rem .75rem;
  border-radius: 8px;
  cursor: pointer;
  background: #1e5a35;
  border-color: #2f7a4b;
  color: #fff;
  font-size: .925rem;
}

body.account-page--favorites .fav-actions .fav-btn--series:hover {
  filter: brightness(1.1);
}

/* Account page: modules.php */
body.account-page--modules .k {
  opacity: .85;
  font-size: .9rem;
}

body.account-page--modules .field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .75rem;
}

body.account-page--modules .field input[type="text"],
body.account-page--modules .field input[type="number"],
body.account-page--modules .field textarea {
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: #1f1f1f;
  color: var(--text-primary);
}

body.account-page--modules .field textarea {
  min-height: 110px;
  resize: vertical;
}

body.account-page--modules .module-title {
  font-weight: 800;
  margin: 0 0 .25rem;
  font-size: 1rem;
}

body.account-page--modules .module-sub {
  opacity: .85;
  margin: 0;
}

body.account-page--modules .actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

body.account-page--modules .actions button {
  background: var(--dark-blue);
  border: none;
  color: #fff;
  padding: .75rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* Mobile drawer menu + stacked dashboard */
@media (max-width: 900px) {
  .account-topbar {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .account-container {
    padding: 1rem 1rem 1.5rem;
  }

  /* menu */
  .account-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .account-nav--desktop {
    display: none;
  }

  .account-nav-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(320px, 82vw);
    background: var(--background-dark);
    border-right: 1px solid var(--glass-border);
    padding: 0.75rem;
    transform: translateX(-102%);
    transition: transform 180ms ease-out;
    z-index: 10001;
    overflow-y: auto;
  }

  .account-nav--drawer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .account-nav--drawer a {
    display: block;
  }

  .account-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--background-darker);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease-out;
    z-index: 10000;
  }

  body.account-drawer-open .account-nav-drawer {
    transform: translateX(0);
  }

  body.account-drawer-open .account-drawer-backdrop {
    opacity: 0.75;
    pointer-events: auto;
  }

  /* dashboard cards: stack, same width */
  .account-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Dashboard helpers */
.account-grid--three {
  grid-template-columns: repeat(3, 1fr);
}

.account-grid--four {
  grid-template-columns: repeat(4, 1fr);
}

.account-grid--two {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1100px) {
  .account-grid--three {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-grid--four {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .account-grid--three,
  .account-grid--two {
    grid-template-columns: 1fr;
  }

  .account-grid--four {
    grid-template-columns: 1fr;
  }

  .logo-text {
    display: none;
  }
}

.account-card--thin {
  padding: .8rem;
}

.account-card {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(157, 216, 255, 0.04), rgba(30, 64, 175, 0.05));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.account-card:hover {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

.account-card .big {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-blue);
}

.toggle-btn {
  background: #0e6de7;
  color: #fff;
  border: none;
  padding: .55rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.toggle-btn:hover {
  filter: brightness(1.1);
}

.form-box {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
}

.form-box form input,
.form-box form textarea {
  width: 100%;
  padding: .55rem .6rem;
  margin-bottom: .65rem;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: #1f1f1f;
  color: var(--text-primary);
}

.form-box form button {
  background: #0e6de7;
  color: #fff;
  border: none;
  padding: .6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}


.token-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.15);
}

.token-table thead th {
  text-align: left;
  font-weight: 700;
  padding: .65rem .75rem;
  background: rgba(157, 216, 255, 0.06);
  border-bottom: 1px solid var(--glass-border);
}

.token-table tbody td {
  padding: .65rem .75rem;
  border-top: 1px solid var(--glass-border);
  vertical-align: middle;
}

.token-table tbody tr:first-child td {
  border-top: none;
}

.token-table tbody tr.token-row--this td {
  background: rgba(14, 109, 231, 0.12);
}

.account-table tr.token-row--this td {
  background: rgba(14, 109, 231, 0.12);
}

.token-device-name {
  font-weight: 600;
}

.token-sub {
  margin-top: .2rem;
  font-size: .85rem;
  opacity: .85;
}

.token-ip {
  white-space: nowrap;
}

.token-action {
  white-space: nowrap;
}

.token-revoke-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  padding: .45rem .7rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.token-revoke-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.editor-inline {
  height: 480px;
  background: #1f1f1f;
  color: var(--text-primary);
  margin-bottom: .6rem;
}

/* Quill Editor Styles */
.ql-toolbar {
  background: rgba(31, 31, 31, 0.9);
  border: 1px solid var(--glass-border)!important;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.ql-container {
  border: 1px solid var(--glass-border)!important;
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #1f1f1f;
  margin-bottom: .65rem!important;
}

.ql-editor {
  color: var(--text-primary);
  background: #1f1f1f;
  min-height: 300px;
  border-radius: 8px;
}

.ql-toolbar button {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.ql-toolbar button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ql-toolbar button.ql-active {
  background: rgba(157, 216, 255, 0.3);
  color: #3d3d3d!important;
}

.ql-toolbar .ql-stroke {
  stroke: #ffffff!important;
}

.ql-toolbar .ql-fill {
  fill: #ffffff!important;
}

.ql-snow .ql-picker-label::before {
  color: #ffffff!important;
}

.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow .ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button:focus .ql-stroke, .ql-snow .ql-toolbar button:focus .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke, .ql-snow .ql-toolbar button.ql-active .ql-stroke, .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke, .ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke, .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke, .ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke, .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke, .ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke, .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke, .ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke, .ql-snow.ql-toolbar button:hover .ql-stroke-miter, .ql-snow .ql-toolbar button:hover .ql-stroke-miter, .ql-snow.ql-toolbar button:focus .ql-stroke-miter, .ql-snow .ql-toolbar button:focus .ql-stroke-miter, .ql-snow.ql-toolbar button.ql-active .ql-stroke-miter, .ql-snow .ql-toolbar button.ql-active .ql-stroke-miter, .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter, .ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter, .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, .ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter, .ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter, .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter, .ql-snow .ql-toolbar .ql-picker-item.ql.selected .ql-stroke-miter {
    stroke: rgb(137, 196, 255) !important;
}

/* Universal account table styles */
.account-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .account-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    table-layout: auto;
    white-space: nowrap;
  }

  .account-table th,
  .account-table td {
    white-space: nowrap;
  }
}

.account-table th,
.account-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.account-table th {
  font-weight: 600;
}

.account-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.account-table a {
  color: white;
  text-decoration: none;
}

.account-table a:hover {
  opacity: 0.8;
}

.account-table .text-right {
  text-align: right;
}

.account-table .text-center {
  text-align: center;
}

.account-table .delete-link {
  color: #9B4040FF;
  margin-left: 0.5rem;
}

/* Section heading */
.section-heading {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* Section heading row (title left, action right) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-header .section-heading {
  margin: 0;
}

/* Badges */
.type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.3rem;
  background: rgba(255, 255, 255, 0.1);
}

/* Form box enhancements */
.form-box h3 {
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.form-box textarea {
  font-family: monospace;
  font-size: 13px;
  height: 500px;
  resize: vertical;
}

/* Deactivated module row */
.account-table tr.deactivated {
  color: #9B4040;
  opacity: 0.6;
}

.account-table tr.deactivated a {
  color: #9B4040;
}

.activate-link {
  color: #4CAF50;
  margin-left: 0.5rem;
}
