:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d8dee9;
  --primary: #2557a7;
  --primary-dark: #1f4788;
  --secondary: #eef2f7;
  --success: #13795b;
  --warning: #b7791f;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.header-inner,
.site-footer .container,
.admin-top,
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  padding: 18px 0;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  gap: 18px;
  font-size: 0.95rem;
}

.main {
  padding: 34px 0 56px;
}

.site-footer {
  padding: 26px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.hero {
  margin-bottom: 24px;
  padding: 28px;
  color: #fff;
  background: linear-gradient(135deg, #214c93, #2d6cdf);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero h1,
.admin-top h1,
.confirmation h1 {
  margin: 4px 0 8px;
  line-height: 1.15;
}

.eyebrow {
  margin: 0;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
}

.card {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.form-grid,
.filters,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.filters {
  grid-template-columns: 1.5fr 1fr 1fr auto;
  align-items: end;
  margin-bottom: 22px;
}

.detail-grid {
  margin-bottom: 22px;
}

.ticket-sections {
  display: grid;
  gap: 22px;
}

.field,
.stack {
  display: grid;
  gap: 8px;
}

.field-full {
  grid-column: 1 / -1;
}

label {
  font-weight: 700;
}

label span {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid #cfd7e3;
  border-radius: 12px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(37, 87, 167, 0.18);
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

small,
.muted {
  color: var(--muted);
}

.section-title {
  padding-top: 8px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

.btn-secondary {
  color: var(--text);
  background: var(--secondary);
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-danger:hover {
  background: #8f1d14;
  text-decoration: none;
}

.alert {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.alert-success {
  color: #0f5132;
  background: #d1e7dd;
  border-color: #badbcc;
}

.alert-error {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

.alert-warning {
  color: #664d03;
  background: #fff3cd;
  border-color: #ffecb5;
}

.confirmation {
  max-width: 720px;
  margin: 30px auto;
  text-align: center;
}

.success-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  background: var(--success);
  border-radius: 999px;
  font-weight: 700;
}

.tracking-number {
  display: inline-block;
  margin: 16px 0;
  padding: 14px 18px;
  background: #eef5ff;
  border: 1px dashed var(--primary);
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-card {
  max-width: 430px;
  margin: 30px auto;
}

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

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

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.empty {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.urgency-low,
.status-closed {
  color: #475569;
  background: #e2e8f0;
}

.urgency-normal,
.status-new {
  color: #1d4ed8;
  background: #dbeafe;
}

.urgency-high,
.status-waiting {
  color: #92400e;
  background: #fef3c7;
}

.urgency-critical {
  color: #991b1b;
  background: #fee2e2;
}

.status-in_progress {
  color: #6d28d9;
  background: #ede9fe;
}

.status-resolved {
  color: #065f46;
  background: #d1fae5;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.info-list div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
}

.info-list dt {
  color: var(--muted);
  font-weight: 700;
}

.info-list dd {
  margin: 0;
}

.preline {
  white-space: pre-line;
}

.attachment-list,
.file-list {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.internal-note-field {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.danger-zone {
  border-color: #f1b6b1;
  background: #fffafa;
}

.danger-zone h2 {
  color: var(--danger);
}

.attachment-list {
  gap: 12px;
  padding-left: 0;
  list-style: none;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.attachment-preview {
  flex: 0 0 auto;
}

.attachment-preview img {
  display: block;
  width: 96px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.attachment-details {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.attachment-details a {
  overflow-wrap: anywhere;
}

.attachment-details span {
  color: var(--muted);
  font-size: 0.9rem;
}

.attachment-download {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  padding: 14px;
  border-left: 4px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
}

.timeline-admin {
  border-left-color: var(--primary);
}

.timeline-system {
  border-left-color: var(--muted);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .header-inner,
  .site-footer .container,
  .admin-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .filters,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .info-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .attachment-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
