/* Базовые стили приложения */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Пропуск навигации (клавиатура / скринридеры) */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 9999;
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Текст только для скринридеров */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Видимый фокус для клавиатурной навигации */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-primary-dark);
  outline-offset: 2px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

input:not([type='checkbox']):not([type='radio']):not([type='hidden']),
select,
textarea {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-control, var(--radius-md));
}

button {
  font: inherit;
  padding: 0.4rem 0.6rem;
}

/* Touch-friendly на мобильных */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px; /* предотвращает зум iOS при фокусе */
  }
  button, .btn-save, .btn-close, .btn-delete {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }
}

button {
  cursor: pointer;
  background: var(--color-primary);
  color: #000000;
  border: none;
  border-radius: var(--radius-control, var(--radius-md));
}

button:hover {
  background: var(--color-primary-hover);
}

button.danger {
  background: var(--color-danger);
}
button.danger:hover {
  background: var(--color-danger-hover);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}
th,
td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
th {
  background: #f9fafb;
  font-weight: 600;
}

.search-bar {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.search-bar input[type='search'] {
  flex: 1;
  min-width: 200px;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
}

.modal h2 {
  margin-top: 0;
}

.form-row {
  margin-bottom: 0.8rem;
}
.form-row label {
  display: block;
  margin-bottom: 0.2rem;
  font-weight: 500;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
}

.error {
  color: var(--color-danger);
}

.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main {
  flex: 1;
  padding: 1rem;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
