.form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;

}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field input[type="file"],
.field textarea,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 14px;

  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: #fff;

  font-size: 15px;
  font-weight: 500;
  color: #111827;
}

.field input[type="file"] {
  padding: 10px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  padding: 10px 14px;
}

.field-inline{
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-inline select{
  flex: 1;
  min-width: 0;
}

/* iOS Safari/Chrome date input: hard fix */
.field input[type="date"]{
  -webkit-appearance: none;
  appearance: none;

  height: 44px;            /* повертаємо */
  line-height: 44px;       /* ключ: прибиває внутрішню висоту */
  padding: 0 14px;
  box-sizing: border-box;
}

/* прибрати внутрішні “поля/кнопки” які роздувають */
.field input[type="date"]::-webkit-date-and-time-value{
  height: 44px;
  line-height: 44px;
}

.field input[type="date"]::-webkit-datetime-edit{
  padding: 0;
  line-height: 44px;
}

.field input[type="date"]::-webkit-calendar-picker-indicator{
  margin: 0;
  padding: 0;
}


.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #94A3B8;
}

.radio-group {
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.radio-group li {
  margin: 0;
  padding: 0;
}

.radio-group input[type="radio"]{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.radio-group label:has(input:focus-visible){
  box-shadow: 0 0 0 3px rgba(148,163,184,0.35);
  border-color: #2563eb;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  min-width: 120px;
  height: 40px;

  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}

.radio-group label:has(input:checked) {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1E3A8A;
}

.radio-group label:has(input[value="income"]:checked) {
  background: #ECFDF5;
  border-color: #86EFAC;
  color: #166534;
}

.radio-group label:has(input[value="expense"]:checked) {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #7F1D1D;
}

.form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 100%;
  padding: 12px 44px 12px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background-color: #fff;

  font-size: 16px;
  cursor: pointer;

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;

}

.field-errors {
  margin-top: 6px;
  font-size: 12px;
  color: #b91c1c;
}

.field-errors ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.helptext {
  margin-top: 6px;
  font-size: 12px;
  color: #64748B;
}

.alerts{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  bottom: calc(100% + 12px);

  width:100%;
  max-width:360px;

  display:grid;
  gap:8px;
}

.alert{
    margin-top: 12px;
    padding: 12px 14px;

    border-left: 4px solid #f59e0b;   /* amber-500 */
    background: #fffbeb;              /* amber-50 */
    border-radius: 8px;
    
    font-size: 14px;
    font-weight: 500;
    color: #92400e;                   /* amber-800 */
    line-height: 1.45;
  
}

.alert-success{
  background:#dcfce7;
  border:1px solid #bbf7d0;
  color:#166534;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: fit-content;
  height: 44px;
  padding: 0 16px;

  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;

  border: 1px solid transparent;
  transition: background-color .15s ease, box-shadow .15s ease, transform .05s ease;
}


/* primary (submit) */
.btn-primary {
  background: #2563EB;           /* blue-600 */
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* hover */
.btn-primary:hover {
  background: #1D4ED8;           /* blue-700 */
}

/* active (press) */
.btn-primary:active {
  transform: translateY(1px);
}

/* focus (keyboard) */
.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, .35);
}

.btn-secondary {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

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

.btn-danger {
  background: #DC2626;
  color: #fff;
}

.btn-danger:hover {
  background: #B91C1C;
}

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

.btn-neutral {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 14px;

  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2px;

  color: #0f172a;                 /* slate-900 */
  background: #f8fafc;            /* slate-50 */
  border: 1px solid #cbd5e1;       /* slate-300 */
  border-radius: 10px;

  text-decoration: none;
  cursor: pointer;

  transition:
    background-color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease;
}

.btn-neutral:hover {
  background: #f1f5f9;             /* slate-100 */
  border-color: #94a3b8;            /* slate-400 */
}

.btn-neutral:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(148,163,184,.35);
}

.action {
  font-size: 14px;
  font-weight: 600;

  color: #475569;        /* slate-600 */
  text-decoration: none;

  background: none;
  border: none;
  padding: 0;

  cursor: pointer;
}

.action:hover {
  color: #1e293b;        /* slate-800 */

}

.action:focus-visible {
  outline: none;
  text-decoration: underline;
}

.note{
  margin-top: 12px;
  padding: 12px 14px;

  border-left: 4px solid #f59e0b;   /* amber-500 */
  background: #fffbeb;              /* amber-50 */
  border-radius: 8px;

  font-size: 14px;
  font-weight: 500;
  color: #92400e;                   /* amber-800 */
  line-height: 1.45;
}

.note-danger{
  display: block;
  max-width: 520px; 
  width: 100%;

  margin-top: 12px;
  padding: 12px 14px;

  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 10px;

  color: #991b1b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;

  white-space: normal; 
  word-break: break-word;
}



.note-danger strong{
  font-weight: 800;
}

.note-danger a{
  color: inherit;
  text-decoration: underline;
}

/* NOTIFICATIONS */

.flash-messages{
  position: fixed;
  top: 58px;            
  right: 16px;
  z-index: 4000;

  display: flex;
  flex-direction: column;
  gap: 10px;

  max-width: calc(100vw - 32px);
}

.flash{
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);

  background: #eaf7ee;
  border: 1px solid #bfe6c8;
  color: #14532d;

  transition: opacity .3s ease, transform .3s ease;
}

.flash.success{
  background: #eaf7ee;
  border: 1px solid #bfe6c8;
  color: #14532d;
}

.flash.error{
  background: #fdecec;
  border-color: #f5bcbc;
  color: #7f1d1d;
}

.flash.info{
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
}

.flash.hide{
  opacity: 0;
  transform: translateY(-6px);
}

.flash-messages.hide{
  opacity: 0;
  transform: translateY(-6px);
}

/* PAGINATION */
.pagination{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.pg_pages{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.pg_btn,
.pg_page{
  text-decoration: none;
  display: grid;
  place-items: center;
  height: 32px;
  min-width: 32px;
  padding: 0 10px;
  border: 1px solid #dfe0e1;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: #fff;
  user-select: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.pg_btn:hover,
.pg_page:hover{
  background: #f6f7f8;
}

.pg_page.is_active{
  background: #2471dc;
  border-color: #2471dc;
  color: #fff;
}

.pg_btn.is_disabled{
  opacity: .45;
  pointer-events: none;
}

/* CATEGORIES PAGINATOR */

.pagination_categories{
  max-width: 575px;
  margin: 12px auto 0;
  justify-content: center;
}

.categories_wrap{
  display: flex;
  flex-direction: column;
  max-width: 575px;
}

.categories_list{
  width: 100%;
}

.pagination_categories{
  justify-content: center;
  margin-top: 12px;
}

