* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f4f4f5;
  color: #18181b;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e4e4e7;
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
}

button:hover {
  background: #fafafa;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #e4e4e7;
}

.tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

main {
  padding: 16px;
}

.hidden {
  display: none !important;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

#searchInput {
  flex: 1;
  max-width: 480px;
  padding: 8px 10px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #f4f4f5;
  font-size: 0.9rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #eff6ff;
}

.editor {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  max-height: calc(100vh - 180px);
  overflow: auto;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

.editor-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 8px;
  z-index: 1;
}

section.field-group {
  margin-bottom: 16px;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 10px;
}

section.field-group h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: #52525b;
}

label span {
  font-weight: 600;
}

input[type='text'],
textarea,
select {
  padding: 6px 8px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
}

textarea {
  min-height: 48px;
  resize: vertical;
}

.conj-table {
  width: 100%;
  font-size: 0.8rem;
}

.conj-table th {
  background: #fafafa;
}

.hint {
  color: #52525b;
  font-size: 0.9rem;
}

.submission-card {
  background: #fff;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.submission-card .actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

#log {
  margin: 16px;
  padding: 12px;
  background: #18181b;
  color: #e4e4e7;
  border-radius: 8px;
  font-size: 0.75rem;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 24px rgb(0 0 0 / 8%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card h1 {
  margin: 0;
}

.login-error {
  color: #dc2626;
  font-size: 0.9rem;
}

header small {
  font-weight: normal;
  color: #71717a;
  font-size: 0.85rem;
}

.audio-panel .audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.audio-panel audio {
  width: 100%;
  margin-top: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 45%);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 20%);
  margin-top: 24px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e4e4e7;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

.modal-header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.modal-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 10px;
}

.modal-form-sections {
  padding: 12px 18px 0;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 18px;
  border-top: 1px solid #e4e4e7;
  position: sticky;
  bottom: 0;
  background: #fff;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.editor-actions .btn-primary,
.modal-actions .btn-primary {
  min-width: 200px;
}

.he {
  direction: rtl;
  text-align: right;
  font-size: 1.05rem;
}
