:root {
  color-scheme: light;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  background-color: #efefef;
  color: #1f1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #efefef;
}

.hidden {
  display: none !important;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px clamp(16px, 5vw, 48px);
  gap: 16px;
  background: #f5f5f5;
  color: #222;
  border-bottom: 1px solid #dcdcdc;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

header h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

main {
  padding: 32px clamp(16px, 5vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1.2rem;
  color: #1f1f1f;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field label {
  font-weight: 600;
  color: #303030;
}

.checkbox-field {
  display: flex;
  align-items: center;
  height: 100%;
}

input[type='text'],
input[type='email'],
input[type='datetime-local'],
input[type='number'],
input[type='password'],
select,
textarea {
  width: 100%;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #f9f9f9;
}

textarea {
  resize: vertical;
}

.recipient-input {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.recipient-input button,
.form-actions button,
.task-actions button,
.ghost-button,
.ghost {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  background: #3e3e3e;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.ghost-button,
.ghost,
.task-actions .ghost {
  background: #5a5a5a;
}

.task-actions .danger {
  background: #1f1f1f;
}

.recipient-input button:hover,
.form-actions button:hover,
.task-actions button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: #ececec;
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.chip button {
  background: transparent;
  border: none;
  color: #555;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
}

.halves {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.recurrence-toggle {
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.helper-text {
  font-size: 0.85rem;
  color: #666;
}

.task-recipients .chip-list {
  margin-bottom: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-dialog {
  background: #fff;
  border-radius: 16px;
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
}

.modal-header .close-modal {
  background: transparent;
  color: #555;
  font-size: 1.5rem;
  padding: 0;
  line-height: 1;
}

.modal-body {
  padding: 16px 24px 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.modal-actions button {
  min-width: 120px;
}

.flash {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ededed;
  color: #333;
  font-weight: 500;
}

.flash.success {
  background: #dcdcdc;
  color: #1f1f1f;
}

.flash.error {
  background: #f1dcdc;
  color: #5a1a1a;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e5e5;
  text-align: left;
  font-size: 0.95rem;
}

th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
}

tr:hover {
  background: #f7f7f7;
}

.status-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: capitalize;
}

.status-scheduled {
  background: #ebebeb;
  color: #333;
}

.status-sent {
  background: #dcdcdc;
  color: #111;
}

.status-error {
  background: #f1dcdc;
  color: #5a1a1a;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: #7a7a7a;
  border: 1px dashed #ccc;
  border-radius: 12px;
}

.status-chip {
  background: #e4e4e4;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

.status-chip.ok {
  background: #d5d5d5;
}

.status-chip.error {
  background: #f1dcdc;
  color: #5a1a1a;
}

.task-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #5a1a1a;
}

.task-meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #666;
}

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

.auth-panel {
  max-width: 420px;
  width: 100%;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
  }

  .form-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
  }
}
