:root {
  --blue: #2f8de4;
  --blue-dark: #166cc0;
  --green: #25a85a;
  --red: #e53950;
  --yellow: #ffbd16;
  --ink: #172033;
  --muted: #748197;
  --line: #e2e7ee;
  --page: #f2f4f7;
  --surface: #fff;
  --shadow: 0 8px 24px rgba(38, 63, 98, .09);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.account-page {
  margin: 0;
  font-family: Arimo, Arial, sans-serif;
  color: var(--ink);
  background: #fff;
  direction: rtl;
}

.account-page button,
.account-page input,
.account-page textarea {
  font: inherit;
}

.site-header {
  padding: 22px 16px 18px;
}

.header-inner {
  width: min(1080px, 100%);
  margin: auto;
  text-align: center;
}

.site-logo {
  width: min(300px, 72vw);
  max-height: 78px;
  object-fit: contain;
  display: block;
  margin: auto;
}

.top-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  position: relative;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  background: #fff;
  color: #33435b;
  text-decoration: none;
  font-weight: 700;
  transition: .18s;
}

.top-nav a:hover {
  transform: translateY(-1px);
  border-color: #9cc9ef;
  background: #f6fbff;
}

.top-nav a.active {
  background: #2f8de4;
  color: #fff;
  border-color: #2f8de4;
}

.top-nav a.create {
  background: #25a85a;
  color: #fff;
  border-color: #25a85a;
}

.top-nav a.logout-link {
  margin-inline-end: auto;
  color: #b42335;
  border-color: #f3c4c8;
  background: #fff5f5;
}

.top-nav a.logout-link-left {
  margin-inline-end: 0;
  margin-inline-start: auto;
}

.page-wrap {
  width: min(1050px, calc(100% - 28px));
  margin: 30px auto 60px;
}

.page-wrap.manage-page {
  width: min(760px, calc(100% - 28px));
}

.page-title {
  text-align: center;
  margin: 0 0 22px;
  font-size: 30px;
}

.page-subtitle {
  text-align: center;
  color: var(--muted);
  margin: -10px 0 25px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.form-card {
  width: min(520px, 100%);
  margin: auto;
}

.field {
  margin-bottom: 17px;
}

.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #dbe2ea;
  border-radius: 11px;
  padding: 13px 14px;
  background: #fff;
  outline: none;
  transition: .18s;
}

.field input:focus,
.field textarea:focus {
  border-color: #69aee9;
  box-shadow: 0 0 0 3px rgba(47, 141, 228, .12);
}

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  min-height: 48px;
  background: #2f8de4;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn:hover {
  background: #247fd3;
}

.helper {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 16px;
}

.helper a {
  color: #1676cd;
}

.alert-box {
  margin-top: 15px;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}

.alert-box.error {
  background: #fff1f2;
  color: #b42335;
}

.alert-box.success {
  background: #eef8ff;
  color: #176cae;
}

.manage-list {
  display: grid;
  gap: 18px;
}

.manage-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.manage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf0f4;
}

.manage-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

.manage-head .votes {
  color: #718096;
  font-size: 14px;
  white-space: nowrap;
}

.manage-body {
  padding: 18px 20px;
  background: #fafbfc;
}

.manage-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.action-btn {
  border: 0;
  border-radius: 9px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-btn.results {
  background: #0d7ff2;
  color: #fff;
}

.action-btn.delete {
  background: #e53950;
  color: #fff;
}

.action-btn.edit {
  background: #ffbd16;
  color: #2b2b2b;
}

.link-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.link-tabs button {
  border: 0;
  background: none;
  color: #1681e8;
  cursor: pointer;
  padding: 4px 0;
}

.link-tabs button.active {
  font-weight: 700;
  border-bottom: 2px solid #1681e8;
}

.code-box {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid #d7dde6;
  border-radius: 9px;
  background: #fff;
  padding: 10px;
  direction: ltr;
  text-align: left;
  color: #4a5568;
}

.empty-note {
  text-align: center;
  color: #7d899b;
  padding: 30px;
}

.empty-note .primary-btn {
  width: auto;
  display: inline-block;
  padding: 0 22px;
  margin-top: 14px;
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, .45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}

.modal-card h3 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.modal-actions .cancel {
  background: #edf1f5;
}

.modal-actions .confirm {
  background: #e53950;
  color: #fff;
}

@media (max-width: 650px) {
  .site-header { padding-top: 16px; }
  .top-nav { gap: 7px; }
  .top-nav a {
    padding: 0 11px;
    min-height: 40px;
    font-size: 14px;
  }
  .top-nav a.logout-link {
    margin-inline-end: 0;
    width: 100%;
    order: -1;
  }
  .page-wrap { margin-top: 20px; }
  .panel { padding: 19px; }
  .page-title { font-size: 25px; }
  .manage-head { align-items: flex-start; flex-direction: column; }
  .manage-body { padding: 15px; }
  .manage-actions .action-btn {
    flex: 1;
    padding-inline: 10px;
  }
}
