@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
  --navy-950: #0a1a2f;
  --navy-900: #0f2440;
  --navy-800: #16324f;
  --navy-700: #1f3f61;
  --gold-500: #c9a227;
  --gold-400: #dab84a;
  --paper: #f6f4ee;
  --ink: #1c2430;
  --ink-soft: #55606f;
  --danger: #b6473c;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  background: var(--paper);
  color: var(--ink);
  direction: rtl;
}

/* ---------- Login page ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 600px at 15% -10%, var(--navy-800), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--navy-700), transparent 55%),
    var(--navy-950);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.auth-card__brand {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-800));
  padding: 34px 30px 26px;
  text-align: center;
  color: #fff;
}

.brand-emblem {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  color: var(--gold-400);
}

.brand-emblem svg {
  width: 100%;
  height: 100%;
}

.auth-card__brand h1 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.auth-card__brand p {
  margin: 0;
  font-size: 13px;
  color: #c9d3df;
  font-weight: 400;
}

.auth-card__gold-rule {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}

.auth-card__body {
  padding: 28px 30px 32px;
}

.auth-card__body h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 18px;
  color: var(--ink);
  text-align: center;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: #fbfbfa;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  background: #fff;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 9px;
  background: var(--navy-900);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.btn-primary:hover {
  background: var(--navy-800);
}

.form-error {
  background: #fbeceb;
  color: var(--danger);
  border: 1px solid #f1cdc9;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

/* ---------- Dashboard shell ---------- */

.app-header {
  background: linear-gradient(160deg, var(--navy-900), var(--navy-800));
  color: #fff;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--gold-500);
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header__brand .brand-emblem {
  width: 34px;
  height: 34px;
  margin: 0;
}

.app-header__titles h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.app-header__titles p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #c9d3df;
  font-weight: 400;
}

.app-nav {
  display: flex;
  gap: 6px;
}

.app-nav a {
  color: #c9d3df;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.app-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-nav a.is-active {
  background: rgba(201, 162, 39, 0.2);
  color: var(--gold-400);
  font-weight: 600;
}

.back-link {
  display: inline-block;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 14px;
}

.back-link:hover {
  color: var(--navy-900);
}

.empty-note {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.9;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.clients-table th {
  text-align: right;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e7e4da;
}

.clients-table td {
  padding: 12px;
  border-bottom: 1px solid #f0eee6;
}

.clients-table tr {
  cursor: pointer;
  transition: background 0.15s;
}

.clients-table tr:hover {
  background: #fbfaf6;
}

.client-form .field {
  margin-bottom: 16px;
}

.client-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.client-form input,
.client-form textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: #fbfbfa;
}

.client-form input:focus,
.client-form textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  background: #fff;
}

.client-form textarea {
  resize: vertical;
}

.save-note {
  background: #eaf6ee;
  color: #2c7a45;
  border: 1px solid #cdeada;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.logout-form button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.logout-form button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.welcome-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e7e4da;
  padding: 28px;
  box-shadow: 0 12px 30px -18px rgba(15, 36, 64, 0.25);
}

.welcome-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--navy-900);
}

.welcome-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.9;
}

.work-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e7e4da;
  padding: 28px;
  margin-top: 20px;
  box-shadow: 0 12px 30px -18px rgba(15, 36, 64, 0.25);
}

.work-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--navy-900);
  border-right: 3px solid var(--gold-500);
  padding-right: 10px;
}

.work-card h3:not(:first-child) {
  margin-top: 26px;
}

.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1.5px dashed #cfd4dc;
  border-radius: 10px;
  padding: 26px 16px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13.5px;
  background: #fbfbfa;
  transition: border-color 0.15s, background 0.15s;
}

.upload-drop:hover {
  border-color: var(--gold-500);
  background: #fdfaf1;
}

.upload-drop__icon {
  font-size: 22px;
  color: var(--gold-500);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.upload-drop__hint {
  font-size: 12px;
  color: #9aa2ad;
}

.file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  background: #f6f4ee;
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
}

.doc-list__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-list__actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.doc-list__actions a {
  color: var(--navy-900);
  font-weight: 600;
  text-decoration: none;
}

.doc-list__actions a:hover {
  color: var(--gold-500);
}

.file-list li {
  font-size: 12.5px;
  background: #f6f4ee;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--ink);
}

textarea#prompt {
  width: 100%;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: #fbfbfa;
}

textarea#prompt:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  background: #fff;
}

.role-toggle {
  display: flex;
  gap: 10px;
}

.role-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  background: #fbfbfa;
  transition: border-color 0.15s, background 0.15s;
}

.role-option:has(input:checked) {
  border-color: var(--gold-500);
  background: #fdfaf1;
  font-weight: 600;
}

.usage-info {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: #9aa2ad;
  text-align: left;
  direction: ltr;
}

.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.btn-preset {
  text-align: right;
  padding: 11px 14px;
  border-radius: 9px;
  border: 1px solid #dde1e7;
  background: #fbfbfa;
  color: var(--navy-900);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-preset:hover {
  border-color: var(--gold-500);
  background: #fdfaf1;
}

.btn-preset:disabled,
.btn-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-send {
  margin-top: 14px;
}

.result-box {
  margin-top: 22px;
  border-top: 1px solid #eee;
  padding-top: 18px;
}

.result-box h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.result-box pre {
  background: #0f2440;
  color: #dfe6ee;
  padding: 14px;
  border-radius: 9px;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

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

.followup-box {
  margin-top: 18px;
  border-top: 1px solid #eee;
  padding-top: 16px;
}

.followup-box textarea {
  width: 100%;
  resize: vertical;
  padding: 11px 13px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fbfbfa;
  margin-bottom: 10px;
}

.followup-box textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  background: #fff;
}

.defense-card {
  border-top: 3px solid var(--gold-500);
}

.defense-paper {
  background: #fffdf7;
  border: 1px solid #e9e3d0;
  border-radius: 10px;
  padding: 28px 26px;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.defense-paper pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  font-size: 14.5px;
  line-height: 2.1;
  color: var(--ink);
}

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

.btn-secondary {
  flex: 1;
  padding: 11px;
  border-radius: 9px;
  border: 1px solid var(--navy-900);
  background: #fff;
  color: var(--navy-900);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f3f2ee;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.defense-edit-box {
  margin-top: 22px;
  border-top: 1px solid #eee;
  padding-top: 18px;
}

.defense-edit-box h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.defense-edit-box textarea {
  width: 100%;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid #dde1e7;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  background: #fbfbfa;
  margin-bottom: 10px;
}

.defense-edit-box textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
  background: #fff;
}

.btn-copy {
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #dde1e7;
  background: #fbfbfa;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-copy:hover {
  border-color: var(--gold-500);
  color: var(--navy-900);
  background: #fdfaf1;
}

.btn-copy.is-copied {
  border-color: #2c7a45;
  color: #2c7a45;
  background: #eaf6ee;
}
