* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  line-height: 1.5;
  font-size: 15px;
}

a {
  color: #1f2937;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

header.topbar {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

header.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

header.topbar .brand {
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  color: #1a1a1a;
}

header.topbar nav a {
  margin-left: 24px;
  text-decoration: none;
  color: #444;
  font-size: 14px;
}

header.topbar nav a:hover {
  text-decoration: underline;
}

main {
  padding: 32px 0 64px;
}

h1 {
  font-size: 22px;
  margin: 0 0 24px;
}

h2 {
  font-size: 17px;
  margin: 0 0 16px;
}

.panel {
  background: #ffffff;
  border: 1px solid #ddd;
  box-shadow: none;
  padding: 24px;
  margin-bottom: 24px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

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

.tile {
  display: block;
  background: #ffffff;
  border: 1px solid #ddd;
  box-shadow: none;
  padding: 32px 24px;
  text-decoration: none;
  color: #1a1a1a;
  text-align: center;
  position: relative;
}

.tile:hover {
  background: #f2f2f2;
  text-decoration: none;
}

.tile .tile-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.tile .tile-desc {
  font-size: 13px;
  color: #6b6b6b;
}

.badge-count {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  background: #1f2937;
  color: #fff;
  font-size: 11px;
  text-align: center;
  margin-left: 6px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 4px;
}

label:first-child {
  margin-top: 0;
}

input[type=text],
input[type=email],
input[type=password],
input[type=tel],
input[type=datetime-local],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 0;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: #1a1a1a;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #1f2937;
  outline-offset: -1px;
}

button,
.btn {
  display: inline-block;
  border: 1px solid #1f2937;
  border-radius: 0;
  background: #1f2937;
  color: #fff;
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
}

button:hover,
.btn:hover {
  background: #111827;
  text-decoration: none;
}

.btn-secondary {
  background: #fff;
  color: #1f2937;
}

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

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

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

.note {
  font-size: 13px;
  color: #6b6b6b;
  margin-top: 8px;
}

.flash {
  padding: 12px 16px;
  border: 1px solid #ccc;
  margin-bottom: 24px;
  font-size: 14px;
}

.flash-success {
  border-color: #1a7f37;
  color: #1a7f37;
  background: #f0fbf3;
}

.flash-error {
  border-color: #b91c1c;
  color: #b91c1c;
  background: #fdecea;
}

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

table th,
table td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}

table th {
  background: #f2f2f2;
  font-weight: 600;
}

table tr td.empty {
  text-align: center;
  color: #6b6b6b;
  padding: 24px;
}

.status {
  font-size: 13px;
  font-weight: 600;
}

.status-new {
  color: #b91c1c;
}

.status-in_progress {
  color: #92660a;
}

.status-resolved {
  color: #1a7f37;
}

.client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
}

.client-row:last-child {
  border-bottom: none;
}

.client-row a {
  text-decoration: none;
  color: #1a1a1a;
  font-weight: 600;
}

.client-row a:hover {
  text-decoration: underline;
}

.dot-unread {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c0392b;
  margin-left: 8px;
  vertical-align: middle;
}

.meta {
  color: #6b6b6b;
  font-size: 13px;
}

.projects-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.projects-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.projects-list li:last-child {
  border-bottom: none;
}

.comment-thread {
  margin: 16px 0;
}

.comment {
  border: 1px solid #ddd;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.comment-client {
  background: #fff;
}

.comment-admin {
  background: #f7f7f7;
}

.comment .comment-meta {
  font-size: 12px;
  color: #6b6b6b;
  margin-bottom: 4px;
}

.attachment-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.attachment-list li {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.upload-row .upload-status {
  color: #6b6b6b;
  font-size: 12px;
}

.upload-row .upload-status.done {
  color: #1a7f37;
}

.upload-row .upload-status.error {
  color: #b91c1c;
}

.form-actions {
  margin-top: 24px;
}

.login-wrap {
  max-width: 380px;
  margin: 64px auto;
}

.login-wrap .panel {
  margin-bottom: 0;
}

.text-center {
  text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
