@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --paper: #F1F0EA;
  --paper-raised: #FAF9F5;
  --ink: #24312C;
  --ink-soft: #56635C;
  --teal: #2F6F62;
  --teal-deep: #1F4B41;
  --line: #D8D5C8;
  --tab-shadow: 0 1px 0 rgba(36,49,44,0.06);
  --danger: #9C4A3C;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
}

a { color: inherit; }

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand .dot { color: var(--teal); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--ink-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: var(--teal-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink-soft); color: var(--ink); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(156,74,60,0.35);
}
.btn-danger:hover { background: rgba(156,74,60,0.08); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* --- Search / filter row --- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
.search-input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

/* --- Month tabs (signature element: binder folder tabs) --- */
.month-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.month-tab {
  flex: none;
  position: relative;
  padding: 9px 16px 8px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--tab-shadow);
}

.month-tab .count {
  display: inline-block;
  margin-inline-start: 6px;
  color: var(--ink-soft);
  font-weight: 500;
  opacity: 0.7;
}

.month-tab.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
.month-tab.active .count { color: #fff; opacity: 0.85; }

.tabs-underline {
  height: 2px;
  background: var(--ink);
  margin-top: -1px;
  margin-bottom: 26px;
}

/* --- Record groups --- */
.month-group {
  margin-bottom: 34px;
}

.month-heading {
  font-size: 15px;
  font-weight: 800;
  color: var(--teal-deep);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.month-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.record-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.record-main { flex: 1; min-width: 0; }

.record-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}

.record-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.record-meta span::before {
  content: '·';
  margin-inline-end: 10px;
  color: var(--line);
}
.record-meta span:first-child::before { content: none; }

.record-notes {
  font-size: 13.5px;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.7;
  margin: 0;
}

.record-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 100px;
  background: rgba(47,111,98,0.12);
  color: var(--teal-deep);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-state .big {
  font-size: 40px;
  margin-bottom: 10px;
}

/* --- Forms --- */
.form-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 640px;
}

.field { margin-bottom: 18px; }

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

input[type=text], input[type=date], input[type=file], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

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

.error-box {
  background: rgba(156,74,60,0.08);
  border: 1px solid rgba(156,74,60,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

.current-file {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}

/* --- Login --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 34px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 50px -20px rgba(36,49,44,0.25);
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

@media (max-width: 620px) {
  .record-card { flex-direction: column; }
  .record-actions { flex-direction: row; }
  .field-row { flex-direction: column; gap: 0; }
}
