@font-face {
  font-family: "PT Sans";
  src: url("/static/fonts/PTSans-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "PT Sans";
  src: url("/static/fonts/PTSans-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-border: #e2e5ea;
  --color-text: #171a1f;
  --color-text-muted: #6b7280;
  --color-primary: #2454ff;
  --color-primary-contrast: #ffffff;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --radius: 10px;
  --sidebar-width: 220px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PT Sans", system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

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

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar__brand { font-weight: 700; font-size: 20px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 10px; }
.sidebar__nav a {
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--color-text);
}
.sidebar__nav a:hover { background: var(--color-bg); text-decoration: none; }
.sidebar__logout { margin-top: auto; }
.sidebar__logout button {
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.content { flex: 1; padding: 32px 40px; max-width: 980px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--color-text-muted); font-size: 14px; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.stat-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1;
}
.stat__value { font-size: 26px; font-weight: 700; }
.stat__label { font-size: 13px; color: var(--color-text-muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--color-border); font-size: 14px; }
th { color: var(--color-text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge--draft { background: #eef0f3; color: var(--color-text-muted); }
.badge--sent { background: #e6edff; color: var(--color-primary); }
.badge--opened { background: #fff4e0; color: var(--color-warning); }
.badge--accepted { background: #e4f8ea; color: var(--color-success); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; margin-top: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=color], input[type=date], textarea, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
  background: var(--color-surface);
}
textarea { resize: vertical; min-height: 70px; }
input[type=color] { height: 40px; padding: 4px; cursor: pointer; }

button, .btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.btn--secondary, .btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
button:disabled { opacity: .6; cursor: default; }

.form-error {
  background: #fdecec;
  color: #b42318;
  border: 1px solid #f3c6c6;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.form-success {
  background: #e4f8ea;
  color: #166534;
  border: 1px solid #b7e3c4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
}
.auth-card { width: 380px; }
.auth-card .brand { font-weight: 700; font-size: 24px; margin-bottom: 4px; }

.block-list { display: flex; flex-direction: column; gap: 12px; }
.block-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--color-surface);
}
.block-item__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.block-item__type { font-size: 12px; text-transform: uppercase; color: var(--color-text-muted); font-weight: 700; }
.drag-handle { cursor: grab; color: var(--color-text-muted); }

.line-items-table input { padding: 6px 8px; }
.line-items-table td { vertical-align: top; }

.copy-link-row { display: flex; gap: 8px; align-items: center; }
.copy-link-row input { flex: 1; background: var(--color-bg); }

/* --- Public proposal page --- */
.proposal-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px;
  font-family: "PT Sans", system-ui, sans-serif;
  color: var(--pp-text, #171a1f);
}
.proposal-header { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.proposal-header img { max-height: 56px; }
.proposal-hero h1 { font-size: 30px; margin-bottom: 4px; }
.proposal-hero .subtitle { color: var(--color-text-muted); margin-bottom: 32px; }
.proposal-section { margin-bottom: 28px; }
.proposal-section h2 { font-size: 18px; border-bottom: 2px solid var(--pp-primary, #2454ff); padding-bottom: 6px; display: inline-block; }
.proposal-items table { margin-top: 10px; }
.proposal-items .amount { text-align: right; white-space: nowrap; }
.proposal-total { text-align: right; font-size: 20px; font-weight: 700; margin-top: 12px; }
.proposal-footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 13px; }
.proposal-accept { text-align: center; margin: 40px 0; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 16px; }
  .sidebar__nav { flex-direction: row; }
  .sidebar__logout { margin-top: 0; }
  .content { padding: 20px; }
}
